📄 search.php
字号:
<?php
include'include/begin.php';
include'include/search.php';
include language();
$pagename_m = $_pagename[31];
$tpl_html = 'search';
include 'include/main.php';
$pagenum = 1;
$tchecked = 'checked';
$uchecked = '';
userp1();
if (!$userp1[7]) {
echoerror(58);
}
if (file_exists('./cache/searchoff.php')) {
echoerror(57);
}
if (!empty($_POST['q'])) {
$q = $_POST['q'];
} else if (isset($_GET['q'])) {
$q = $_GET['q'];
} else {
$q = null;
}
$q = trim($q);
if ($q) {
if ($q == 'all' || $q == 's' || $q == 't' || $q == 'b') {
$su = 2;
}
if (isset($_POST['t'])) {
$su = $_POST['t'] == 'user'?1 : null;
}
if (!$su) {
$kword = StripSlashes($q);
$length = bstrlen($kword);
if ($length < 4 || $length > 20) {
echoerror(67);
}
} else {
$tchecked = '';
$uchecked = 'checked';
$kword = '';
}
$kwordurl = urlencode($q);
}
$_GET['page'] = is_numeric($_GET['page'])?$_GET['page']: 1;
if ($su) {
$result = mysql_query("select * from {$db_prefix}config where id='62'", $myconn);
$row = mysql_fetch_array($result);
$uc = explode(',', $row['value']);
if ($su == 2) {
$tchecked = "";
$uchecked = "checked";
if ($_GET["q"] == "all") {
$sql = "";
$numpage = $uc[3];
$_b[all] = "font-weight: bold;";
} else if ($_GET["q"] == "s") {
$sql = "where admin!=0 || forums!='' ";
$numpage = $uc[0];
$_b[s] = "font-weight: bold;";
} else if ($_GET["q"] == "t") {
$sql = "where groups!='' ";
$numpage = $uc[1];
$_b[t] = "font-weight: bold;";
} else if ($_GET["q"] == "b") {
$sql = "where blank=1 ";
$numpage = $uc[2];
$_b[b] = "font-weight: bold;";
} else {
echoerror(10);
}
$list_l = ($_GET['page']-1) * $headnum;
$result = mysql_query("select * from {$db_prefix}members $sql ORDER BY id LIMIT $list_l,$headnum ", $myconn);
} else if ($su == 1) {
$pagelist = '';
$result = mysql_query("select * from {$db_prefix}members where username='$q'", $myconn);
$numpage = mysql_num_rows($result);
}
if ($numpage) {
$pagelist = spage();
while ($row = mysql_fetch_array($result)) {
$tx = null;
if ($row["admin"] != 0) {
$tx .= $sysgroupname[$row["admin"]] . "/";
}
if ($row["forums"]) {
$tx .= $sysgroupname[11] . "/";
}
if ($row["groups"]) {
$tx .= $_p_search[0];
}
$usera_s = array('name' => $row['username'], 'urlname' => urlencode($row['username']), 'a' => $row['a'], 'b' => $row['b'], 'c' => $row['c'], 'regdate' => echodate($row['regdate']), 'postnum' => $row['postnum'], 'up_num' => $row['up_num'], 'tx' => $tx,);
$jjx4 .= tpl_fun_jjx4(array($usera_s), array('abc' => $abc));
}
} else {
$_GET['page'] = 1;
}
} else if ($q != '') {
$numpage = 0;
$kwa = null;
$result = mysql_query("select * from {$db_prefix}keyword where kword='$q'", $myconn)or die(mysql_error());
$row = mysql_fetch_array($result);
if ($row['list'] != '') {
if ($row["ip"] != $_SERVER['REMOTE_ADDR']) {
mysql_query("update {$db_prefix}keyword set count=count+1,ip='$_SERVER[REMOTE_ADDR]' where kword='$q' " , $myconn);
}
if ($row['list'] != 0) {
$kwa = explode(",", $row["list"]);
$numpage = count($kwa);
$pagelist = spage();
$startps = ($_GET['page']-1) * $headnum;
$kwanew = array_slice($kwa, $startps, $headnum);
$kwasql = implode(',', $kwanew);
$result2 = mysql_query("select * from {$db_prefix}search where cid in($kwasql)", $myconn)or die(mysql_error());
$jjx3a = array();
while ($trow = mysql_fetch_array($result2)) {
$jjx3a[$trow['cid']] = tpl_fun_jjx3(array('tid' => $trow['cid'], 's_title' => htmlspecialchars($trow['title']), 'content' => htmlspecialchars($trow['content']), 's_author' => $trow['author'], 'posttime' => echotime($trow['posttime']), 's_hits' => $trow['hits'], 's_replies' => $trow['replies'], 'forumname' => $forumnames[$trow['fid']]));
} while (list(, $val) = each($kwanew)) {
$jjx3 .= $jjx3a[$val];
}
}
} else {
$searchkey = addslashes(searchstr($kword, 'se'));
$result2 = mysql_query("select * from {$db_prefix}search WHERE MATCH (btitle,bcontent) AGAINST ('$searchkey' IN BOOLEAN MODE)" , $myconn);
$i = 0;
$list = null;
$numpage = mysql_num_rows($result2);
$pagelist = spage();
while ($trow = mysql_fetch_array($result2)) {
if ($i < $headnum) {
$jjx3 .= tpl_fun_jjx3(array('tid' => $trow['cid'], 's_title' => htmlspecialchars($trow['title']), 'content' => htmlspecialchars($trow['content']), 's_author' => $trow['author'], 'posttime' => echotime($trow['posttime']), 's_hits' => $trow['hits'], 's_replies' => $rtow['replies'], 'forumname' => $forumnames[$trow['fid']]));
}
$i++;
$list[] = $trow['cid'];
}
$klist = is_array($list)?implode(',', $list): '0';
mysql_query("REPLACE into {$db_prefix}keyword values('$q','$klist','0','$_SERVER[REMOTE_ADDR]')" , $myconn)or die(mysql_error());
}
}
if ($q != '') {
$jjx1 = tpl_fun_jjx1(array('jjx3' => $jjx3, 'jjx4' => $jjx4, 'kword' => htmlspecialchars($kword), 'tchecked' => $tchecked, 'uchecked' => $uchecked, 'numpage' => $numpage, 'pagenum' => $pagenum, 'echo' => $numpage?'display: none;': '', 'pageh' => $pagenum >1?'' : 'display: none;', 'kwordurl' => $kwordurl, 'templatedir' => $templatedir, 'pagelist' => $pagelist), array('_b' => $_b));
} else {
$result = mysql_query("select * from {$db_prefix}config where id='60'", $myconn);
$row = mysql_fetch_array($result);
$update = $row['value']?echotime($row['value']): $_p_search[2];
$jjx2 = tpl_fun_jjx2(array('skey' => htmlspecialchars($kword), 'tchecked' => $tchecked, 'uchecked' => $uchecked, 'update' => $update, 'updata' => $updata), array('_b' => $_b));
}
include_once'./cache/template/m_' . $style_id . '_' . $tpl_html . '.php';
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -