这是我得到的错误:
警告:无法修改标头信息 - 标头已由 /home/content/72/10756672/html/nightmarerising/includes/ 中的(输出开始于 /home/content/72/10756672/html/nightmarerising/login_register.php:15)发送第 63 行的 login.inc.php
警告:无法修改标头信息 - 标头已由 /home/content/72/10756672/html/nightmarerising/includes/ 中的(输出开始于 /home/content/72/10756672/html/nightmarerising/login_register.php:15)发送第 63 行的 login.inc.php
警告:无法修改标头信息 - 标头已由 /home/content/72/10756672/html/nightmarerising/includes/ 中的(输出开始于 /home/content/72/10756672/html/nightmarerising/login_register.php:15)发送第 65 行的 login.inc.php
这是我的代码:
<?php require_once('Connections/nightmarerising.php'); ?>
<?php // Connects to your Database
mysql_select_db("nightmarerising") or die(mysql_error());
//Checks if there is a login cookie
if(isset($_COOKIE['ID_my_site']))
//if there is, it logs you in and directes you to the members page
{
$username = $_COOKIE['ID_my_site'];
$acct_password = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT username,acct_password FROM account WHERE username = '".$_POST['username']."' AND acct_password='".md5($_POST['acct_password'])."'")or die(mysql_error());
while($info = mysql_fetch_array( $check ))
{
if ($acct_password['acct_password'] != $info['acct_password'])
{ }
else
{
header("Location: index.php");
}
}
}
//if the login form is submitted
if (isset($_POST['submit']))
{
// if form has been submitted
// makes sure they filled it in
if(!$_POST['username'] | !$_POST['acct_password'])
{
die('You did not fill in a required field.');
}
// checks it against the database
if (!get_magic_quotes_gpc())
{
$_POST['email'] = addslashes($_POST['email']);
}
$check = mysql_query("SELECT username FROM account WHERE username = '".$_POST['username']."'")or die(mysql_error());
//Gives error if user dosen't exist
$check2 = mysql_num_rows($check);
if ($check2 == 0)
{ ?><br/><?php
die('That user does not exist in our database. <a href=register.php>Click Here to Register</a>');
}
while($info = mysql_fetch_array( $check ))
{
$_POST['acct_password'] = stripslashes($_POST['acct_password']);
$info['acct_password'] = stripslashes($info['acct_password']);
$_POST['acct_password'] = md5($_POST['acct_password']);
//gives error if the password is wrong
if ($_POST['acct_paassword'] == $info['acct_password'])
{
// if login is ok then we add a cookie
$_POST['username'] = stripslashes($_POST['username']); $hour = time() + 3600; setcookie(ID_my_site, $_POST['username'], $hour); setcookie(Key_my_site, $_POST['acct_password'], $hour);
//then redirect them to the members area
header("Location: index.php");
}
else
{
?><br/><?php
die('Incorrect password, please try again.');
}
}
}
else {
// if they are not logged in
?>
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
<table border="0">
<tr><td colspan=2><h1>Login</h1></td></tr>
<tr><td>Username:</td><td><input type="text" name="username" maxlength="40"></td></tr>
<tr><td>Password:</td><td><input type="password" name="acct_password" maxlength="50"> </td></tr>
<tr><td colspan="2" align="right"><input type="submit" name="submit" value="Login"> </td></tr>
</table>
</form>
<?php } ?>
提前感谢您对此的任何帮助。