Beispiel #1
0
        die_error('搜索词太长');
    }
    if (!preg_match("/^[\\x{4e00}-\\x{9fa5}A-Za-z0-9_\\-\\.\\s]+\$/u", $q)) {
        die_error($q . ' ===> 搜索词只允许下划线,数字,字母,汉字,横杠和空格,请重新输入');
    }
    $sql = "SELECT * FROM " . TB_PREFIX . "keyword WHERE keyword = '{$_GET['q']}'";
    $res = $dbm->query($sql);
    $_SESSION['postdata']['search'] = time();
    if (is_array($res['list']) && count($res['list']) > 0) {
        $sql = "UPDATE " . TB_PREFIX . "keyword SET qnum = qnum+1 WHERE keyword = '{$_GET['q']}'";
        $dbm->query_update($sql);
    } else {
        $fields = array();
        $fields['keyword'] = helper::escape($_GET['q']);
        $fields['qnum'] = 1;
        $dbm->single_insert(TB_PREFIX . "keyword", $fields);
    }
}
//【003-1】判断是否绑定域名,匹配域名对应的分类
foreach ($c->categories as $k => $v) {
    if (strstr($v['go_url'], $_SERVER['HTTP_HOST'])) {
        if (!isset($_GET['tpl'])) {
            $_GET['tpl'] = 'list_info';
            $_GET['cid'] = $v['cate_id'];
            break;
        }
    }
}
//【004】处理GET参数
$cid = isset($_GET['cid']) ? $_GET['cid'] : '';
//分类ID