我有要求用戶的登錄信息發送給一個cookie,然後登錄頁面驗證細節,但由於某種原因,它不允許我登錄。如果我在本地測試它安裝在深淵Web服務器我的電腦它工作正常,但如果我在我的託管服務器上測試它不工作在這裏是我的代碼:餅乾不註冊
它的工作原理就是這樣一旦登錄頁面被選中,它會詢問詳細信息然後發生,然後如果用戶沒有被激活,它要求激活用戶,如果用戶被激活,則登錄工作,但一旦用戶不在,它不會比激活請求繼續更多。
登錄問:
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>?cont=true&loginUSER=true" style="font-family:Calibri;">
<fieldset style="border-style:none">
<p>
Email: <input style="position:absolute; left:30%;" onkeyup="javascript: this.value=this.value.toLowerCase();" class="details" type="text" name="email" id="email" />
</p>
<p>
Password: <input style="position:absolute; left:30%;" class="details" type="password" name="password" id="password" />
</p>
<input type="submit" value="login" class="btn" style="background-color:#FFF; border-style:solid; border-width:thin; font-family:Calibri;" />
</fieldset>
</form>
將它首先檢查登錄,如果沒有cookie的存在,然後如果確實存在
//A new login first create cookies and check if they are valid
if(!isset($_COOKIE["thebillboard"]))
{
//Don't allow user to login if this is not true;
$thisIsValid = false;
//set cookies for login details entered!
$email = $_POST["email"];
$pass = $_POST["password"];
setcookie("thebillboard",$email,time()+3600);
setcookie("password",$pass,time()+3600);
//check if the login details exists
$clients = mysql_query("SELECT * FROM clients");
while($row = mysql_fetch_array($clients))
{
if(($row["businessEmail"] == $email) && ($row["password"]) == $pass)
{
$thisIsValid = true;
break;
}
}
}
//If the cookies exists check if they are valid
elseif(isset($_COOKIE["thebillboard"]))
{
//Don't allow user to login if this is not true;
$thisIsValid = false;
//get cookies for login if it exists!
$email = $_COOKIE["thebillboard"];
$pass = $_COOKIE["password"];
//check if the login details exists
$thisIsValid = false;
$clients = mysql_query("SELECT * FROM clients");
while($row = mysql_fetch_array($clients))
{
if(($row["businessEmail"] == $email) && ($row["password"] == $pass))
{
$thisIsValid = true;
break;
}
}
那麼如果變量$ thisIsValid是事實,就繼續和顯示其他登錄用戶在其登錄信息返回錯誤
不要在Cookie中存儲密碼 –