Roost3r
10-30-2002, 08:55 PM
im getting this error: Warning: Cannot add header information - headers already sent by (output started at /home/cklepeis/public_html/login.php:10) in /home/cklepeis/public_html/login.php on line 105
line 105 is: setcookie("xhcookie", $mahname, time() - 3600);
<?php
$db = mysql_connect("localhost", "bleh", "bleh");
mysql_select_db("xhdb",$db);
if ($submit)
{
$getmyname = mysql_query("Select * from users where name ='$mahname'", $db) or die("Login system error, please report this to the webmaster.");
if (mysql_num_rows($getmyname) == 0)
{
echo "Incorrect username.";
}
else
{
while ($checkpass = mysql_fetch_array($getmyname)) {
$myname = $checkpass["user"];
$mypassword = $checkpass["psswd"];
$mystatus = $checkpass["status"];
if ($mypassword == $mahpassword)
{
echo "Thank you for logging in ".$mahname;
setcookie("xhcookie", $mahname, time() - 3600);
}
else
{
echo "Wrong password";
}
}
}
}
else {
?>
<center><b><u>Login</u></b><br><br>
<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST">
UserName: <INPUT TYPE="text" NAME="mahname" size="15" maxlength="15"><br>
Password: <INPUT TYPE="password" NAME="mahpassword" SIZE="15" maxlength="15"><br>
<INPUT TYPE="submit" value="Submit" name="submit">
</FORM>
Forget your information? <a href="login.php">Email my info</a><br>
<a href="register.php">Register</a>
</center>
<?php
}
?>
thanks
line 105 is: setcookie("xhcookie", $mahname, time() - 3600);
<?php
$db = mysql_connect("localhost", "bleh", "bleh");
mysql_select_db("xhdb",$db);
if ($submit)
{
$getmyname = mysql_query("Select * from users where name ='$mahname'", $db) or die("Login system error, please report this to the webmaster.");
if (mysql_num_rows($getmyname) == 0)
{
echo "Incorrect username.";
}
else
{
while ($checkpass = mysql_fetch_array($getmyname)) {
$myname = $checkpass["user"];
$mypassword = $checkpass["psswd"];
$mystatus = $checkpass["status"];
if ($mypassword == $mahpassword)
{
echo "Thank you for logging in ".$mahname;
setcookie("xhcookie", $mahname, time() - 3600);
}
else
{
echo "Wrong password";
}
}
}
}
else {
?>
<center><b><u>Login</u></b><br><br>
<FORM ACTION="<?=$PHP_SELF?>" METHOD="POST">
UserName: <INPUT TYPE="text" NAME="mahname" size="15" maxlength="15"><br>
Password: <INPUT TYPE="password" NAME="mahpassword" SIZE="15" maxlength="15"><br>
<INPUT TYPE="submit" value="Submit" name="submit">
</FORM>
Forget your information? <a href="login.php">Email my info</a><br>
<a href="register.php">Register</a>
</center>
<?php
}
?>
thanks