|
Posted by Tyno Gendo on 04/08/07 12:44
cibalo wrote:
> On Apr 8, 2:58 pm, "J.O. Aho" <u...@example.net> wrote:
>> cib...@gmx.co.uk wrote:
>>> Hello,
>>> I use the session id as the shopping cart id in mysql database. I am
>>> just wondering if it is possible to close the current session id and
>>> force a new session id after the shopping cart check-outed.
>> Page1: kill the session
>> use header() and redirect to page2
>>
>> Page2: create new session
>>
>> --
>>
>> //Aho
>
> Hello J.O. Aho!
>
>
> Many thanks to you for replying to my post. Let's try your suggestion
> into coding as follows:
> test-a.php:
> <?php
> session_start();
> $sid=session_id();
> setcookie('sid', $sid, time()+60*60*24*7);
> header('Location: test-b.php');
>
> exit;
>
> ?>
>
> test-b.php:
> <?php
> session_start();
> $sid2=session_id();
> $sid1=$_COOKIE['sid'];
> echo "<h1>Session #1 = $sid1</h1><h1>Session #2 = $sid2</h1>";
>
> exit;
>
> ?>
>
> Running test-a.php will redirect to test-b.php, the two session id's
> echoed are the same session id. Your suggestion doesn't work! Please
> correct my coding if I misinterpret your suggestion.
>
> Any Suggestions Are Welcome!!!
>
> Thank you very much for your assistance.
>
> Best Regards,
>
> cibalo
>
You need to call session_destroy() if you want to cancel a session.
Navigation:
[Reply to this message]
|