如果cookie不等於可用的,我正在努力重定向用戶。如果它等於可放大的話,那麼它應該繼續劇本。這裏是我的代碼重定向:如何重定向如果Cookie不等於可以
if(empty($_GET)) {
//No variables are specified in the URL.
//Do stuff accordingly
echo "No variables specified in URL...";
} else {
//Variables are present. Do stuff:
$id = htmlspecialchars($_GET["id"]);
echo 'url query is ' . $id;
}
if(isset($_COOKIE['logged_in']) == $id)
{
header("Location: test.php");
}
if(isset($_COOKIE['logged_in']) != $id)
{
//continues the script
請注意,在如果statment($ ID)的vairable是從URL的查詢vairable;例如,如果url是「random.com/test.php?id=17」,並且cookie等於18,則腳本應該重定向。但是,如果url是「random.com/test.php?id=17」且cookie等於17,則保持在同一頁面上。對不起,如果它聽起來compcompated。
它不工作,因爲這段代碼:它不會重定向,無論可比的等價。謝謝
你能解釋一下嗎? '「random.com/test.php?id=17」和cookie等於18腳本應重定向'當腳本說如果相等,它應該重定向。你能回顧你的問題嗎? – 2015-04-05 09:19:43