我有这段代码应该检查页面是否不存在,或者它是否包含任何不应该包含的内容,并且由于某种原因,如果我转到任何页面以外的页面,它会向我抛出错误,更具体地说是 406主页 ($_GET = "")。
这是代码,提前感谢您的帮助:)
$currentpage = $_GET['a'];
$pages[1] = "";
$pages[2] = "help";
$pages[3] = "work";
$pages[4] = "download";
$pages[5] = "process";
$pages[6] = "safariex";
$pages[7] = "services";
if(isset($_GET) && !ctype_alpha($_GET) && $_GET['a'] != ""){
header("Location: http://pattersoncode.ca/error.php?ec=406");
}
if (!ctype_alpha($_GET['a']) && $_GET['a'] != "") {
header("Location: http://pattersoncode.ca/error.php?ec=406");
}
if ( ! in_array( $currentpage, $pages ) )
{
header("Location: http://pattersoncode.ca/error.php?ec=404");
}