...

View Full Version : print phpsessid id



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



session_name("the_ID");
session_start();

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

ess
11-03-2006, 11:30 AM
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.

<?php
# 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

urgido
11-03-2006, 08: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:


session_name('the_ID');
session_start();
$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?

Regards

urgido
11-03-2006, 09:02 PM
solved!

session_id(); is my solution. Regards



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum