about session and passing SID

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mickey
Forum Newbie
Posts: 24
Joined: Thu May 01, 2003 11:14 am
Location: Philippines

about session and passing SID

Post 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.
User avatar
Gianni_T
Forum Newbie
Posts: 8
Joined: Fri Aug 01, 2003 12:47 am
Location: Bari, Italy
Contact:

Post 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).
mickey
Forum Newbie
Posts: 24
Joined: Thu May 01, 2003 11:14 am
Location: Philippines

Post by mickey »

i think php will only do that when you set globals = on in it's config file...
User avatar
werlop
Forum Commoner
Posts: 68
Joined: Sat Mar 22, 2003 2:50 am
Location: /dev/null

Post by werlop »

Try <?php print session_id(); ?>

David
mickey
Forum Newbie
Posts: 24
Joined: Thu May 01, 2003 11:14 am
Location: Philippines

Post by mickey »

yes that thing works, it shows my session id....
Post Reply