Re: [PHP] Problem using session From: * R&zE: (renze <email protected>)
Date: 08/28/01

<Original message>
From: Rosen <rosen_dm <email protected>>
Date: Tue, Aug 28, 2001 at 02:43:05PM +0300
Message-ID: <20010828142100.60181.qmail <email protected>>
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 <email protected> -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>