function content_search() { $MyPage = CurrentPageName(); $page = CurrentPageName(); $tpl = new templates(); $sock = new sockets(); $q = new mysql_meta(); $table = "snapshots"; $database = null; $ID = $_GET["ID"]; if (!$q->TABLE_EXISTS($table, $database)) { json_error_show("no data - no table"); } $searchstring = string_to_flexquery(); $page = 1; $q = new mysql_meta(); $table = "(SELECT hotspot_members.creationtime, hotspot_members.uid, metahosts.hostname,hotspot_members.uuid FROM \n\thotspot_members,metahosts WHERE hotspot_members.uuid=metahosts.uuid) as t"; if (isset($_POST["sortname"])) { if ($_POST["sortname"] != null) { $ORDER = "ORDER BY {$_POST["sortname"]} {$_POST["sortorder"]}"; } } if (isset($_POST['page'])) { $page = $_POST['page']; } $sql = "SELECT COUNT(*) as TCOUNT FROM {$table} WHERE 1 {$searchstring}"; $ligne = mysql_fetch_array($q->QUERY_SQL($sql, $database)); $total = $ligne["TCOUNT"]; if (isset($_POST['rp'])) { $rp = $_POST['rp']; } $pageStart = ($page - 1) * $rp; $limitSql = "LIMIT {$pageStart}, {$rp}"; $sql = "SELECT * FROM {$table} WHERE 1 {$searchstring} {$ORDER} {$limitSql}"; $results = $q->QUERY_SQL($sql, $database); if (!$q->ok) { json_error_show($q->mysql_error_html(), 1); } if (mysql_num_rows($results) == 0) { json_error_show("no data {$sql}"); } $data = array(); $data['page'] = $page; $data['total'] = $total; $data['rows'] = array(); if (!$q->ok) { json_error_show($q->mysql_error); } $fontsize = 22; $c = 1; // //service,server_port,client_port,helper,enabled $style = "style='font-size:18px'"; while ($ligne = mysql_fetch_assoc($results)) { $c++; $creationtime = $ligne["creationtime"]; $zdate = $tpl->time_to_date($creationtime, true); $uid = $ligne["uid"]; $hostname = $ligne["hostname"]; $key = md5(serialize($ligne)); $cell = array(); $cell[] = "<span {$style}>{$zdate}</a></span>"; $cell[] = "<span {$style}>{$uid}</a></span>"; $cell[] = "<span {$style}>{$hostname}</a></span>"; $data['rows'][] = array('id' => $key, 'cell' => $cell); } $data['total'] = $c; echo json_encode($data); }