summaryrefslogtreecommitdiff
path: root/search.php
blob: 4a838e40e3759ecfc18e86d83befad29b9a3bd78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<html> 

<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, target-densityDpi=device-dpi">
<link rel="stylesheet" href="./res/styles.css">
<script src="./res/main.js"></script>
</head>

<body> 
<div id="container"> 
    <?php include_once('music.php');?>
    <?php include_once('header.php');?>
    <?php include_once('titlebar.php');?>
    <?php include_once 'config.php'?>
    <?php 
        $type = $_GET['type']; // 'tag', 'name'
        $value = $_GET['value']; // tag id, name
        $page = $_GET['page']; // page从0开始
    ?>
    <div id="search-condition">
    <?php 
        $musiclist = null;
        if($type == "tag") {
            echo '<label class="search-hint">Tag : </label>';
            $tag = fetch_tag_by_id($value);
            echo '<label class="search-value">' . $tag->name . "</label>"; 
            $musiclist = fetch_musics_by_tag($tag->uid, $page * Config::$music_per_page, Config::$music_per_page);
        }
        else if($type == "name") {
            echo '<label class="search-hint">Searching : </label>';
            echo '<label class="search-value">' . $value . "</label>"; 

            $musiclist = fetch_musics_by_name($value, $page * Config::$music_per_page, Config::$music_per_page);
        }

    ?>
    </div>
    <?php include_once('musiclist.php');?>
    
</div>
</body>

</html>