Im使用WP 3.5.2和WPMU。我开发一页http://baohiem.info/chon-mat-gui-vang.此页面使用全局$wpdb查询表\\u博客。(\\u博客已自定义,添加了一些字段。)提交表单时,我使用GET方法,但登录时,我有数据($\\u REQUEST;$\\u GET),但没有登录,没有数据。为什么?我不明白发生了什么事。有人能帮我吗?
非常感谢。
<?php
get\\u header();?>
<form action="" method="get">
<input id="searchfield-cmgv" type="text" name="hoten" placeholder="Họ và tên tư vấn viên...." size="35" value="<?=$_REQUEST[\'hoten\']?>"/>
<!-- location-->
<select name="location">
<option value="">-------- Tỉnh/TP --------</option>
<option value="Hà Nội" <?php if($_REQUEST[\'location\']==\'Hà Nội\') echo \'selected\';?> >Hà Nội</option>
<option value="TP Hồ Chí Minh" <?php if($_REQUEST[\'location\']==\'TP Hồ Chí Minh\') echo \'selected\';?> >TP Hồ Chí Minh</option>
<!-- <option value="Huế" <?php if($_REQUEST[\'location\']==\'Huế\') echo \'selected\';?> >Huế</option>-->
<option value="Đà Nẵng" <?php if($_REQUEST[\'location\']==\'Đà Nẵng\') echo \'selected\';?> >Đà Nẵng</option>
<option value="Hải Phòng" <?php if($_REQUEST[\'location\']==\'Hải Phòng\') echo \'selected\';?> >Hải Phòng</option>
<option value="Đồng Nai" <?php if($_REQUEST[\'location\']==\'Đồng Nai\') echo \'selected\';?> >Đồng Nai</option>
<!-- <option value="Đồng Tháp">Đồng Tháp</option>
<option value="Gia Lai">Gia Lai</option> -->
<option value="Hà Giang" <?php if($_REQUEST[\'location\']==\'Hà Giang\') echo \'selected\';?> >Hà Giang</option>
<!-- <option value="Hà Nam">Hà Nam</option>
<option value="Hà Tĩnh">Hà Tĩnh</option> -->
<option value="Hải Dương" <?php if($_REQUEST[\'location\']==\'Hải Dương\') echo \'selected\';?> >Hải Dương</option>
<option value="Nghệ An" <?php if($_REQUEST[\'location\']==\'Nghệ An\') echo \'selected\';?> >Nghệ An</option>
<option value="Thái Nguyên" <?php if($_REQUEST[\'location\']==\'Thái Nguyên\') echo \'selected\';?> >Thái Nguyên</option>
<option value="Yên Bái" <?php if($_REQUEST[\'location\']==\'Yên Bái\') echo \'selected\';?> >Yên Bái</option>
</select>
<select name="company">
<option value="">-------- Công ty --------</option>
<option value="Prudential" <?php if($_REQUEST[\'company\']==\'Prudential\') echo \'selected\';?> >Prudential</option>
<option value="Manulife" <?php if($_REQUEST[\'company\']==\'Manulife\') echo \'selected\';?> >Manulife</option>
<option value="AIA" <?php if($_REQUEST[\'company\']==\'AIA\') echo \'selected\';?> >AIA</option>
<option value="Dai-ichi Life" <?php if($_REQUEST[\'company\']==\'Dai-ichi Life\') echo \'selected\';?> >Dai-ichi Life</option>
<option value="ACE Life" <?php if($_REQUEST[\'company\']==\'ACE Life\') echo \'selected\';?> >ACE Life</option>
<option value="Bảo Việt" <?php if($_REQUEST[\'company\']==\'Bảo Việt\') echo \'selected\';?> >Bảo Việt</option>
<option value="Hanwha Life" <?php if($_REQUEST[\'company\']==\'Hanwha Life\') echo \'selected\';?> >Hanwha Life</option>
<option value="Generali" <?php if($_REQUEST[\'company\']==\'Generali\') echo \'selected\';?> >Generali</option>
<option value="Chưa có" <?php if($_REQUEST[\'company\']==\'Chưa có\') echo \'selected\';?> >Chưa có</option>
</select>
<input type="hidden" value="true" name="confirm" />
<input id="searchbutton" value="Tìm kiếm" type="submit">
</form>
<?php
global $wpdb;
// lấy thông tin công ty, họ tên, location
$company = $_GET[\'company\'];
$hoten = $_GET[\'hoten\'];
$location = $_GET[\'location\'];
if(!$company && !$hoten && !$location){
// string query
$strquery = \'
SELECT bh_blogs.blog_id
FROM bh_blogs
WHERE bh_blogs.blog_id >1
AND bh_blogs.deleted =0
ORDER BY bh_blogs.voted DESC
\';
// get result
$res = $wpdb->query($strquery);
// display result
//
//
} else {
//var_dump($location); var_dump($company); var_dump($hoten);
$strquery = \'
SELECT bh_blogs.blog_id
FROM bh_blogs
WHERE bh_blogs.blog_id > 1 AND bh_blogs.deleted =0 \';
if($hoten!=\'\') $strquery .= \' AND bh_blogs.site_name LIKE "%\'.$hoten.\'%" \';
if($company!=\'\') $strquery .= \' AND bh_blogs.company="\'.$company.\'" \';
if($location!=\'\') $strquery .= \' AND bh_blogs.location="\'.$location.\'" \';
$strquery .= \' ORDER BY bh_blogs.voted DESC \';
//display result
//
//
}
get_footer();
?>
url:http://baohiem.info/chon-mat-gui-vang/?hoten=&location=Hải+Phòng&;公司=保诚不工作。我无法获取[\'location\',获取[\'hoten\',获取[\'company]
已解决:我使用插件提高了WP安全性,并过滤了我的URL。
启用传递参数,如:示例。com?src=某些源(&S);页码=1。。。。。登录到您的ACP。更好的WP安全性/系统调整,取消选中“过滤可疑查询字符串”选项。
注意:关注您的参数对您的站点是安全的:)
圣诞快乐。