我有一个登录页面,要求用户登录详细信息将其发送到 cookie,然后验证详细信息,但由于某种原因它不允许我登录。如果我在我的计算机上安装的 abyss 网络服务器上本地测试它,它工作正常但如果我在我的托管服务器上对其进行测试,它在这里不起作用是我的代码:
一旦选择登录页面,它就会像这样工作,它会询问详细信息然后会发生什么然后如果用户没有被激活它会要求激活用户如果用户被激活,登录就可以工作,但只要用户不是它就可以不要继续超过激活请求。
登录问:
<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,它首先检查登录,然后如果存在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 为真,它会继续并显示登录用户,否则它会在登录详细信息中返回错误