mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
init
This commit is contained in:
19
searchsuggest.php
Normal file
19
searchsuggest.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
require "include/bittorrent.php";
|
||||
dbconn();
|
||||
if (isset($_GET['q']) && $_GET['q'] != '')
|
||||
{
|
||||
$searchstr = trim($_GET['q']);
|
||||
|
||||
$suggest_query = sql_query("SELECT keywords AS suggest, COUNT(*) AS count FROM suggest WHERE keywords LIKE " . sqlesc($searchstr . "%")." GROUP BY keywords ORDER BY count DESC, keywords DESC LIMIT 10");
|
||||
$result = array($searchstr, array(), array());
|
||||
while($suggest = mysql_fetch_array($suggest_query)){
|
||||
if (strlen($suggest['suggest']) > 25) continue;
|
||||
$result[1][] = $suggest['suggest'];
|
||||
$result[2][] = $suggest['count']." times";
|
||||
$i++;
|
||||
if ($i >= 5) break;
|
||||
}
|
||||
echo json_encode($result);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user