Page 1 of 1

about session and passing SID

Posted: Mon Aug 04, 2003 8:57 pm
by mickey
hi,

just installed php win 32 installer, did nothing with the php.ini (globals == off)

anyway, i've been having problem passing the session id to the url,

i tried the sample on the docs manual,

Code: Select all

<?php
if (!session_is_registered('count')) &#123;
    session_register('count');
    $count = 1;
&#125;
else &#123;
    $count++;
&#125;
?>

Hello visitor, you have seen this page <?php echo $count; ?> times.<p>

To continue, <A HREF="nextpage.php?<?php echo strip_tags (SID)?>">click here</A>
but the link only has this: nextpage.php?
where is the session id?

also, did i get it right? i just need to use session_register("vars") on the login page, no need to use it on the other page because you just need to use session_start() and all registered vars will be retrieved and made available.

many thanks.

Posted: Tue Aug 05, 2003 12:32 am
by Gianni_T
You don't need to do this manually. PHP do this by itself (if it can't use cookies to track a session).

Posted: Tue Aug 05, 2003 6:29 am
by mickey
i think php will only do that when you set globals = on in it's config file...

Posted: Tue Aug 05, 2003 7:36 am
by werlop
Try <?php print session_id(); ?>

David

Posted: Tue Aug 05, 2003 8:41 am
by mickey
yes that thing works, it shows my session id....