-
Notifications
You must be signed in to change notification settings - Fork 25
/
artistsearch.php
140 lines (140 loc) · 4.2 KB
/
artistsearch.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
<?php
set_time_limit(0);
ignore_user_abort(1);
if(!$_POST['q']||!$_POST['w']||!$_POST['r']):
print(json_encode(array('content' => false)));
exit;
endif;
header('Content-Type: application/json');
$ch = curl_init('http://api.joox.com/web-fcgi-bin//web_category_search?callback=mutiara&lang=id&country=id&type=2&search_input='.rawurlencode(trim($_POST['q'])).'&pn='.trim($_POST['w']).'&sin='.trim($_POST['e']).'&ein='.trim($_POST['r']).'&_='.time());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.109 Safari/537.36');
$json = curl_exec($ch);
curl_close($ch);
$json = str_replace('mutiara(', '', $json);
$json = str_replace(')', '', $json);
$json = json_decode($json);
$list = '<div class="row"><div class="col-md-12"><div class="alert alert-success"><b>'.$json->resultnum.'</b> artis yang ditemukan terkait dengan "<b>'.trim($_POST['q']).'</b>"</div></div>';
$res = count($json->result);
for($i=0;$i<$res;$i++):
if(count($json->result)<1)
$list .= '<div class="col-md-3"><img class="img-circle" src="assets/images/default-avatar.png" width="140" height="140"></div>';
else{
$singername = base64_decode($json->result[$i]->singername);
$singer = (strlen($singername)>16) ? substr($singername, 0, 16).'..' : $singername;
$list .= '<div class="col-md-3"><img class="img-circle" src="'.$json->result[$i]->bigpic.'" width="128" height="128"><p><a class="btn btn-default" href="singer.php?id='.$json->result[$i]->id.'" role="button">'.$singer.' »</a></p></div>';
}
endfor;
$list .= '</div>';
if($json->resultnum<=30):
$btn1 = 1;
$btn2 = 0;
$btn3 = 0;
$btn4 = 0;
$btn5 = 0;
$btn6 = 0;
$btn7 = 0;
$btn8 = 0;
$btn9 = 0;
$btn10 = 0;
elseif($json->resultnum<=60):
$btn1 = 1;
$btn2 = 1;
$btn3 = 0;
$btn4 = 0;
$btn5 = 0;
$btn6 = 0;
$btn7 = 0;
$btn8 = 0;
$btn9 = 0;
$btn10 = 0;
elseif($json->resultnum<=90):
$btn1 = 1;
$btn2 = 1;
$btn3 = 1;
$btn4 = 0;
$btn5 = 0;
$btn6 = 0;
$btn7 = 0;
$btn8 = 0;
$btn9 = 0;
$btn10 = 0;
elseif($json->resultnum<=120):
$btn1 = 1;
$btn2 = 1;
$btn3 = 1;
$btn4 = 1;
$btn5 = 0;
$btn6 = 0;
$btn7 = 0;
$btn8 = 0;
$btn9 = 0;
$btn10 = 0;
elseif($json->resultnum<=150):
$btn1 = 1;
$btn2 = 1;
$btn3 = 1;
$btn4 = 1;
$btn5 = 1;
$btn6 = 0;
$btn7 = 0;
$btn8 = 0;
$btn9 = 0;
$btn10 = 0;
elseif($json->resultnum<=180):
$btn1 = 1;
$btn2 = 1;
$btn3 = 1;
$btn4 = 1;
$btn5 = 1;
$btn6 = 1;
$btn7 = 0;
$btn8 = 0;
$btn9 = 0;
$btn10 = 0;
elseif($json->resultnum<=200):
$btn1 = 1;
$btn2 = 1;
$btn3 = 1;
$btn4 = 1;
$btn5 = 1;
$btn6 = 1;
$btn7 = 1;
$btn8 = 0;
$btn9 = 0;
$btn10 = 0;
elseif($json->resultnum<=210):
$btn1 = 1;
$btn2 = 1;
$btn3 = 1;
$btn4 = 1;
$btn5 = 1;
$btn6 = 1;
$btn7 = 1;
$btn8 = 1;
$btn9 = 0;
$btn10 = 0;
elseif($json->resultnum<=240):
$btn1 = 1;
$btn2 = 1;
$btn3 = 1;
$btn4 = 1;
$btn5 = 1;
$btn6 = 1;
$btn7 = 1;
$btn8 = 1;
$btn9 = 1;
$btn10 = 0;
elseif($json->resultnum<=300):
$btn1 = 1;
$btn2 = 1;
$btn3 = 1;
$btn4 = 1;
$btn5 = 1;
$btn6 = 1;
$btn7 = 1;
$btn8 = 1;
$btn9 = 1;
$btn10 = 1;
endif;
print(json_encode(array('result' => true, 'content' => $list, 'btn1' => array('show' => $btn1, 'q' => trim($_POST['q']), 'w' => 1, 'e' => 0, 'r' => 29) , 'btn2' => array('show' => $btn2, 'q' => trim($_POST['q']), 'w' => 2, 'e' => 30, 'r' => 59), 'btn3' => array('show' => $btn3, 'q' => trim($_POST['q']), 'w' => 3, 'e' => 60, 'r' => 89), 'btn4' => array('show' => $btn4, 'q' => trim($_POST['q']), 'w' => 4, 'e' => 90, 'r' => 119), 'btn5' => array('show' => $btn5, 'q' => trim($_POST['q']), 'w' => 5, 'e' => 120, 'r' => 149), 'btn6' => array('show' => $btn6, 'q' => trim($_POST['q']), 'w' => 6, 'e' => 150, 'r' => 179), 'btn7' => array('show' => $btn7, 'q' => trim($_POST['q']), 'w' => 7, 'e' => 180, 'r' => 199), 'btn8' => array('show' => $btn7, 'q' => trim($_POST['q']), 'w' => 8, 'e' => 210, 'r' => 199), 'btn9' => array('show' => $btn9, 'q' => trim($_POST['q']), 'w' => 9, 'e' => 240, 'r' => 199), 'btn10' => array('show' => $btn10, 'q' => trim($_POST['q']), 'w' => 10, 'e' => 270, 'r' => 199), 'sum' => $json->resultnum)));