When a user logs in, I call authenticate.php and in that file is the following code that runs if the user enters a valid username/password:
Code: Select all
$_SESSION['player_name']=$playername;
echo "<center>You are now logged in $playername. Have fun!<br></center>";
header('Refresh: 2; URL=index.php');
exit;
Code: Select all
if (isset($_SESSION['player_name']))
{
$playername = $_SESSION['player_name'];
echo "$playername logged in";
}
else
{
include 'login.php';
}
My problem is, the first branch of the if statement is not running, meaning the session is not being set (?), but I'm setting it in authenticate.php right before it refreshes back to index.php. What am I missing here?

