<?php
$user = mysql_real_escape_string($_POST['login']);
$password = mysql_real_escape_string(sha1($_POST['password']));
$query = mysql_query("SELECT * FROM `users` WHERE name = '$user' AND pass = '$password' AND privileges = 'superuser'");
$num_rows = mysql_num_rows($query);
if($num_rows == '1') {
$expire = time()*60*60*60*60;
setcookie("user","$user",$expire);
$_SESSION['user'] = $user;
include '/views/admin/admin.php';
}
else {
echo "Username and Password are incorrect! (Maybe you don't have permission!)";
}
?>
它说
警告:无法修改标头信息 - 标头已由 Z:\home\test1.ru\www\views\ 中的(输出开始于 Z:\home\test1.ru\www\views\admin\validate.php:1)发送第 9 行的 admin\validate.php
第 9 行是 - setcookie("user","$user",$expire);