in the below code, everything works. However if the user is logged in (where is says html goes here) it wont display anything at all.
<?php
// Connects to your Database
mysql_connect('host', "user", "password") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
//checks cookies to make sure they are logged in
if(isset($_COOKIE['ID_']))
{
$email = $_COOKIE['ID_'];
$pass = $_COOKIE['Key_'];
$check = mysql_query("SELECT * FROM users WHERE username = '$user'")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'])
{ echo "<center><a href='index.php'>Invalid Password! Please Click Here to Log In</a></center>";
}
//otherwise they are shown the admin area
else
{
?>
html goes here
<?php
}
}
}
else
//if the cookie does not exist, they are taken to the login screen
{
echo "<center><a href='index.php'>You DO Not Have Permission to View this Page! Please Click Here to Log In</a></center>";
}
?>