| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2000-07-07 19:59 UTC] thomas at neweve dot com
  [2000-07-27 21:04 UTC] waldschrott@php.net
  [2001-10-28 10:43 UTC] jeroen@php.net
  | 
    |||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 12:00:01 2025 UTC | 
This is a baffling problem. Perhaps I'm doing something wrong but I believe I'm doing everything correct. Here is an example script of what I'm talkinng about please save this in a file called "login.phtml" or change the FORM tag to reflect the filename you choose.: ----- <? session_start(); if ($login) { echo "Posted Variable (echo \$PHPSESSID): " . $PHPSESSID . "<BR>"; //session_id($PHPSESSID); echo "session started (echo session_id()): " . session_id() . "<BR>"; session_register("user","pass"); echo "Variable Registered in session (echo session_id()): " . session_id() . "<BR>"; } ?><HTML> <HEAD> <TITLE>Login Testing</TITLE> </HEAD> <BODY BGCOLOR=#FFFFFF> <BR><BR> Session display using "echo SID;":<? echo SID; ?><BR><BR> <FORM METHOD=POST ACTION="login.phtml"> form field populated using <? echo session_id(); ?><BR> Posting Variable: PHPSESSID: <INPUT TYPE=TEXT NAME="PHPSESSID" VALUE="<? echo session_id(); ?>" WIDTH=50><BR> USER: <INPUT TYPE="text" NAME="user"><BR> PASS: <INPUT TYPE="text" NAME="pass"><BR> <INPUT TYPE=SUBMIT VALUE="login" NAME="login"><BR> </FORM> </BODY> </HTML> ---- In this example, when session_start() is called, a new session variable is created. If I you uncomment the line that forces the session ID back to what it should be, the variables get registered in the proper session but when you echo SID it reverts to the previous session and the $PHPSESSID is updated also to the new, incorrect, session. This was done by testing under an SSL connection because this is where I need to use it. The installation is Apache 1.3.12+mod_ssl One Curious thing: If I change it the method to GET then this is what happens. at the first initialization of the session it creates it, then when you submit the form, a new session is created. But every post after that retains the session ID. Will this only work via the GET method? I sincerely hope not because I need to keep the password hidden.