I used this code:
Code: Select all
setcookie("loggedin", "TRUE", time()+(3600 * 24));
setcookie("mysite_username", "$username");
echo "You are now logged in!<br>";
echo "Continue to the <a href=members.php>members</a> section.";
At the end of a file I called login.php. So far the script works great. The problem comes in when I click the link to take me to the members page.
I am using this code on the members.php page:
Code: Select all
<font face="verdana" size="1">
<?php if (!isset($_COOKIE['loggedin'])) die("You are not logged in!");
$mysite_username = $HTTP_COOKIE_VARS["mysite_username"];
echo "you are logged in as $mysite_username."; ?>
but even though I log in correctly with valid informationg it still brings up the message "You are not logged in!" It's like it's either not finding the login cookie or it's not setting one...Can someone help me?