美好的一天,我遇到了上面所说的错误,我找不到合适的脚本。但这是发生错误的那一行。
$db = mysql_connect($mysql_server, $mysql_username, $mysql_password);
mysql_select_db($mysql_database, $db);
$sql = "SELECT password, fullname, active FROM ".$mysql_table." WHERE username = '".$_POST['username']."'";
$result = mysql_query($sql, $db) or trigger_error ( mysql_error ( ) );
if ($data = mysql_fetch_array($result))
{
if ($crypt_pass == $data['password'] && $data['active'] != 0)
{
$found = true;
$fullname = $data['fullname'];
}
else die(mysql_error());
}
mysql_close($db);
if($found == false)
{
header('Location: '.$error_page);
exit;
}
else
{
session_start();
$_SESSION['username'] = $_POST['username'];
$_SESSION['fullname'] = $fullname;
$rememberme = isset($_POST['rememberme']) ? true : false;
if ($rememberme)
{
setcookie('username', $_POST['username'], time() + 3600*24*30);
setcookie('password', $_POST['password'], time() + 3600*24*30);
}
header('Location: '.$success_page);
exit;
}
顺便说一句,这是一个登录表单..
谢谢!