Hello please help me troubleshooting this. i got this error in my login.. pleaaaaase. below is the error that prompts me when i login:
PHP Warning: Cannot modify header information - headers already sent by (output started at D:\HostingSpaces\spindev\spindev.spinweb.ph\wwwroot\YPS\login\login.php:9) in D:\HostingSpaces\spindev\spindev.spinweb.ph\wwwroot\YPS\login\login.php on line 71 PHP Warning: Cannot modify header information - headers already sent by (output started at D:\HostingSpaces\spindev\spindev.spinweb.ph\wwwroot\YPS\login\login.php:9) in D:\HostingSpaces\spindev\spindev.spinweb.ph\wwwroot\YPS\login\login.php on line 72 PHP Warning: Cannot modify header information - headers already sent by (output started at D:\HostingSpaces\spindev\spindev.spinweb.ph\wwwroot\YPS\login\login.php:9) in D:\HostingSpaces\spindev\spindev.spinweb.ph\wwwroot\YPS\login\login.php on line 75
Here is my code: please tell me what's going wrong. thanks. :)
<?php
// Connects to your Database
mysql_connect("spindev.spinweb.ph", "spindev_ypsuser", "yps123") or die(mysql_error());
mysql_select_db("spindev_ypsnew") or die(mysql_error());
//checks cookies to make sure they are logged in
if(isset($_COOKIE['ID_my_site']))
{
$username = $_COOKIE['ID_my_site'];
$pass = $_COOKIE['Key_my_site'];
$check = mysql_query("SELECT * FROM users WHERE username = '$username'")or die(mysql_error());
while($info = mysql_fetch_array( $check ))
{
//if the cookie has the wrong password, they are taken to the login page
if ($pass != $info['password'])
{ header("Location: login.php");
}
//otherwise they are shown the admin area
else
{
echo "Admin Area<p>";
echo "Your Content<p>";
echo "<a href=logout.php>Logout</a>";
}
}
}
else
//if the cookie does not exist, they are taken to the login screen
{
header("Location: login.php");
}
?>
:)