View Full Version : print phpsessid id

11-03-2006, 10:43 AM
Hi I have the following code:


So, I want to print the ID in the url bar like http://myhome.com/index.php?the_ID=here_the_session_id

How I can do this? Regards

11-03-2006, 12:30 PM
you can do this as follow.

Before sending a response to the browser, you process all links in your website and pass your session id.

# you should check that a session has already started. if not start it
# before issuing the following statement

$my_id = "?the_ID=" . $_SESSION['the_ID'];

# now locate all of your links and append the above variable


I don't know how you are storing your links i.e. files, or in database.

if in a file... you need to use a regular expression to append the session id in the file. Note: can affect server performance

good luck

11-03-2006, 09:20 PM
I stores the session ID on a table called "users" in a row "sessionweb" and I put the following code on the head of my page:

$my_id = "?the_ID=".$_SESSION['the_ID'];

and on my Link:

<a href="index.php<? echo $my_id; ?>">Home</a>

but it don't show the number id only show in the url bar: http://www.myhome.com/index.php?the_ID=

What's wrong?


11-03-2006, 10:02 PM

session_id(); is my solution. Regards

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum