Here is my PHP: (that code does it's job well)
if(isset($_COOKIE["user"])) {
$username = $_COOKIE["user"];
$pass = $_COOKIE["password"];
$check = mysql_query("SELECT * FROM members WHERE email = '$username'")or die(mysql_error());
while ($info = mysql_fetch_array( $check ))
{
//if the cookie is present but has the wrong password, they are taken to the login page
if ($pass != $info['password'])
{
header("Location: login.php");
exit();
}
else //if the cookie is present and doesn'T have the wrong password they are shown the admin area
{
include 'header.php';
}
}
}
else //if the cookie is present and doesn'T have the wrong password they are shown the admin area
{
header("Location: login.php");
exit();
}
but later on the same page, I try to access data from the $info variable and nothing comes out. I know i'm doing something wrong, but can't figure out what...
<?php print $info['name']?>
If I make my variable global, how do I use it the while ?
$check = mysql_query("SELECT * FROM members WHERE email = '$username'")or die(mysql_error());
$info = mysql_fetch_array( $check );
while ($info.....???)
{
}