Re: Session problem

From: Date: Wed, 12 Jul 2000 04:33:33 +0000
Subject: Re: Session problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-6060@lists.php.net to get a copy of this message
I tried your page, and you should reread http://www.php.net/manual/ref.session.php Most importantly, --snip PHP is capable of doing this transparently when compiled with --enable-trans-sid. If you enable this option, relative URIs will be changed to contain the session id automatically. Alternatively, you can use the constant SID which is defined, if the client did not send the appropiate cookie. SID is either of the form session_name=session_id or is an empty string. The following example demonstrates how to register a variable, and how to link correctly to another page using SID. Example 1. Counting the number of hits of a single user 1 2 <?php 3 session_register("count"); 4 $count++; 5 ?> 6 7 Hello visitor, you have seen this page <? echo $count; ?> times.<p> 8 9 <php? 10 # the <?=SID?> is necessary to preserve the session id 11 # in the case that the user has disabled cookies 12 ?> 13 14 To continue, <A HREF="nextpage.php?<?=SID?>">click here</A> 15 --end snip Your code shows --snip <FORM METHOD=POST ACTION="login.phtml?PHPSESSID=<? echo session_id(); ?>"> --end snip Hmm...you're setting PHPSESSID explicitly and the example from www.php.net shows that your line SHOULD be... <FORM METHOD=POST ACTION="login.phtml?<?=SID?>"> or <FORM METHOD=POST ACTION="login.phtml?<?echo session_id();?>"> Ya might try setting it that way and see if you get the correct id's. -Szii

« previous php.general (#6060) next »