|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-11-14 08:41 UTC] novell at kiruna dot se
[2002-11-14 09:09 UTC] iliaa@php.net
[2002-11-14 10:50 UTC] guerrini at dada dot it
[2002-11-15 04:38 UTC] guerrini at dada dot it
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 08:00:02 2025 UTC |
After execution of header("Location:otherfile.php?".SID); the session file previously created does not contain all the items posted by a form. My configuration: Linux RH6.2 (tested also RH7.2 and RH 7.3) Apache 1.3.27 PHP 4.2.3 compiled as a CGI './configure' '--enable-shared' '--with-system-regex' '--with-gd=/usr/local' '--enable-ftp' '--with-mysql' '--enable-track-vars' '--with-ttf=/usr' '--enable-gd-native-ttf' '--with-jpeg-dir' '--with-png-dir' '--with-zlib' '--enable-force-cgi-redirect' '--enable-dbase' '--with-config-file-path=/usr/local/apache/conf' register_globals=1 session_trans_sid=1 (tested also =0) I have 2 files index.php and lib1.inc When I start index.php a session file is created (under /tmp) and contains the variable name ( !sessione| ). When I post the form (in index.php), the session file under /tmp does not get updated. If I comment out the line header("Location:otherfile.php?".SID); instead, the session file is updated with the values posted by the form. It behaves as if execution of header("location ... cleared the session file. These are the files involved: 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>