When I start index.php a session file is created (under /tmp) and contains the variable name ( !sessione| ).
I fill in the form fields and post the data.
I expect that the session file (sess_xyz... under /tmp) gets updated. but it is not.
If I comment out the line header("Location:newfile.php?".SID); instead, the session file gets updated !
It is as if the header(location) function created a new session file .....
Do you have any idea ?
Thanks a lot
PHP 4.2.2 is compiled as a CGI, apache 1.3.27.
register_globals=1
session_trans_sid=1
I have 2 files "lib1.inc" and "index.php":
LIB1.INC
<?
session_start();
session_register("sessione");
[....other functions here ....]
function SessioneUtente($fusern,$fpassw,$fnome,$fcognome,$fpriv,$femail)
{
global $sessione;
$sessione[nome]=$fnome;
$sessione[cognome]=$fcognome;
$sessione[username]=$fusern;
$sessione[password]=$fpassw;
$sessione[priv]=$fpriv;
$sessione[email]=$femail;
$sessione[loggato]=true;
}
?>
INDEX.PHP
<?
include("lib1.inc");
$messaggio="";
if (isset($azione) && $azione=="vai")
{
if(empty($logon[username]) || empty($logon[password]))
$messaggio.="devi riempire tutti i campi";
//DEFINISCO l'ARRAY CU che conterrĂ i dati utente (username,password,priv, ecc.)
$cu=checkUser( $logon[username], $logon[password]);
if(!empty($logon[password]) && $logon[password]!=$cu[password])
$messaggio .= "utente o password errati, riprova";
if ($messaggio=="")
{
SessioneUtente($cu[username],$cu[password],$cu[nome],$cu[cognome],$cu[priv],$cu[email]);
header("Location:otherfile.php?".SID);
}
}
?>
<html>
<head>
<title>login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Quanta Plus">
</head>
<body>
<?
if($messaggio!="")
echo $messaggio;
?>
<form action="<?echo $PHP_SELF; ?>" method="post">
<input type="hidden" name="azione" value="vai">
<div align=center>
<table border=1 cellpadding=0 cellspacing=0>
<tr>
<td colspan=2>
Login
</td>
</tr>
<tr>
<td>
Username
</td>
<td>
<input type="text" name="logon[username]" value="<?echo $logon[username]; ?>">
</td>
</tr>
<tr>
<td>
Password
</td>
<td>
<input type="password" name="logon[password]" maxlength=8>
</td>
</tr>
<tr>
<td align=right colspan=2>
<input type="submit" value=accedi>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>