forked from PRNDA/you2php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
63 lines (57 loc) · 2.34 KB
/
search.php
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
if(!is_array($_GET)&&count($_GET)<=0){
exit();
}
include("./lib.php");
$headtitle=$_GET["q"].'-'.SITE_NAME;;
include("./header.php");
$order=isset($_GET['order'])?$_GET['order']:'relevance';
$order1=$order;
$q=urlencode($_GET["q"]);
$type=isset($_GET['type'])?$_GET['type']:'video';
if($type=='channel'){
$order1='channel';
}
?>
<div class="container">
<div class="py-2">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12 col-lg-12">
<span class="txt2 pt-1 pb-1" style="text-align: center;display:block;">搜索:<?php echo $_GET["q"] ?></span>
<div class="row"> <div class="col-md-12 selectalign"> 搜索选项: <select class="custom-select" id="paixu">
<?php
switch ($order1){
case 'relevance':
$relevance='selected';
break;
case 'date':
$date1='selected';
break;
case 'viewCount';
$viewCount='selected';
case 'channel';
$channel='selected';
break;
}
echo '<option '.$relevance.' data-url="./ajax/ajax.php?q='.$q.'&type=video&order=relevance&ptk='.$_GET['pageToken'].'">按相关程度排序</option>';
echo '<option '.$date1.' data-url="./ajax/ajax.php?q='.$q.'&type=video&order=date&ptk='.$_GET['pageToken'].'">按上传日期排序</option>';
echo '<option '.$viewCount.' data-url="./ajax/ajax.php?q='.$q.'&type=video&order=viewCount&ptk='.$_GET['pageToken'].'">按观看次数排序</option>';
echo '<option '.$channel.' data-url="./ajax/ajax.php?q='.$q.'&type=channel&order=relevance&ptk='.$_GET['pageToken'].'">仅搜索频道</option>';
?>
</select></div></div>
<div id="videocontent" class="pt-2 videocontentrow"></div>
</div>
<script>
$("#videocontent").load('<?php echo './ajax/ajax.php?q='.$q.'&type='.$type.'&order='.$order.'&ptk='.$_GET['pageToken']?>');
$('#paixu').on('change', function() {
loadPage($(this).find(':selected').data('url'));
});
function loadPage(url) {
$("#videocontent").load(url);
}
</script>
</div>
</div> </div>
<?php
include("./footer.php");
?>