Re: Problem using session

From: Date: Tue, 28 Aug 2001 11:58:59 +0000
Subject: Re: Problem using session
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-64764@lists.php.net to get a copy of this message
<Original message> From: Rosen <rosen_dm@dir.bg> Date: Tue, Aug 28, 2001 at 02:43:05PM +0300 Message-ID: <20010828142100.60181.qmail@pb1.pair.com> Subject: [PHP] Problem using session > Hi, > I'm creating system with user registration. I want to use sessions without cookies. > My cookies are disabled. > > this is my login.php: > > global $curusr, $curpass, $registered; > > > if (lExistUser( $usr, $pwd ) == false ) // is user exist ? > { > echo $usr . $pwd; > echo " - Error"; > session_destroy(); > $curusr=""; > $curpass=""; > $registered=false; > exit; > > } > // all ok ! user Exist > $curusr=$usr; > $curpass=$pwd; > $registered=true; > > session_start(); > session_register(curusr, curpass, registered ); > > $web="http://www.somedomain.com"; // my site > header("Location: $web"); > exit; > > > But when I get control in my index.php there are no the variables. > > Any ideas why ? > > Thanks, > > Rosen Marinov </Original message> <Reply> If you want to use sessions without using cookies, you should send the session-ID to the next page using the URL (not a very nice solution though). See: http://www.php.net/manual/en/ref.session.php <quote from PHP manual> The following example demonstrates how to register a variable, and how to link correctly to another page using SID. Example 3. Counting the number of hits of a single user <?php session_register ("count"); $count++; ?> Hello visitor, you have seen this page <?php echo $count; ?> times.<p> <php? # the <?=SID?> is necessary to preserve the # session id # in the case that the user has disabled # cookies ?> To continue, <A HREF="nextpage.php?<?=SID?>">click here</A> The <?=SID?> is not necessary, if --enable-trans-sid was used to compile PHP. </quote from PHP manual> </Reply> -- * R&zE: -- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze@datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««

« previous php.general (#64764) next »