I've written a photo gallery script and have a login screen for the admin panel.
One of the users has to revalidate their username and password each time they select an option. It works for me though. I've accessed their admin panel and it does the same for me so I'm thinking it's a server issue. They've provided me with their phpinfo and the settings are identical except for the session_bug options.
This is the relevant part of the code:
include ('./header.php'); //header.php contains session_start(); as well as include('definitions.php'); which defines ADMIN_USER and ADMIN_PASS
$users=array(ADMIN_USER => ADMIN_PASS);
$user="";
if (array_key_exists('user',$_SESSION))
$user=$_SESSION['user'];
if($user==''||$users[$user]=='')
{
$username = "";
if (array_key_exists('username',$_POST))
$username=$_POST['username'];
if (array_key_exists('password',$_POST))
$password=$_POST['password'];
if($username!=''&&$users[$username]==$password)
{
$user=$username;
$_SESSION['user']=$user;
}
else
{
echo "<title>Gallery Admin Login</title>\n";
echo "</head>\n";
echo "<body>\n";
echo "<div>\n";
echo "<form method=\"post\" action=\"\"><div>\n";
echo "\tUsername:<br/><input name=\"username\" /><br/>\n";
echo "\tPassword:<br/><input type=\"password\" name=\"password\" /><br/>\n";
echo "\t<br/><input type=\"submit\" value=\"Login\" />\n";
echo "</div></form>\n";
echo "</div>\n";
echo "</body>\n";
echo "</html>\n";
die();
}
}
//rest of the admin panel follows here