我正在使用登录脚本。它工作正常,直到我开始使用PHP 5.4。在我更新我的PHP版本后,它似乎似乎没有注册cookie。有人可以指出我的问题,或者是否有其他我可以使用而不是$ _SESSION
session_start();
ob_start();
include('../db.php');
if(!isset($_SESSION['adminuser'])){
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// username and password sent from Form
$adminuser=mysql_real_escape_string($_POST['adminuser']);
$adminpassword=mysql_real_escape_string($_POST['adminpassword']);
$gpassword=md5($adminpassword); // Encrypted Password
$sql="SELECT id FROM admin WHERE adminuser='$adminuser' and adminpassword='$gpassword'";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
// If result matched $username and $password, table row must be 1 row
if($count==1)
{
$_SESSION["adminuser"] = $adminuser;
header("location:index.php");
}
else
{
header("location:login.php?error=error");
}
}
ob_end_flush();
提前感谢。