can someone help me with this:
i'm having a strange problem using sessions,i have a login system based on sessions, and sometimes i can't login, the problem is that i can indeed login but the page creates another session id,sending me back to the login page, i get the tmp dir full of sess_*************** files with 0kb.First i thought that was something wrong with my code, and i did the simplest system i know:
login.html
- Code: Select all
<html>
<body>
<form method="post" action="login.php">
<input type="text" name="user"><br>
<input type="text" name="pass">
<input type="submit" name="submit" value="send">
</form>
</body>
</html>
?>
login.php
- Code: Select all
<?php
session_start();
if($_POST['submit'])
{
if($_POST['user']=="master")
{
if($_POST['pass'] == "blaster")
{
session_register('user');
$_SESSION['user']=$_POST['user'];
header("Location: secret.php");
exit;
}
}
else
{
echo "Login or Password wrong<br>";
<a href="login.html">Click here to login again.</a>
}
}
?>
secret.php
- Code: Select all
<?php
session_start();
if(!empty($_SESSION['login']))
{
echo "Welcome to the secret page";
}
else
{
<a href="login.html">You have to login to access this page
}
?>
and it didn't work....a few hours later it worked.
i really don't know what to do anymore.
if it helps, i'm running this on Windows XP + SP2
if anybody knows or have clue, please let me know.
thanks