Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-03-2006, 09:43 AM   PM User | #1
urgido
Regular Coder

 
Join Date: Aug 2005
Posts: 257
Thanks: 8
Thanked 0 Times in 0 Posts
urgido is an unknown quantity at this point
print phpsessid id

Hi I have the following code:

PHP 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
urgido is offline   Reply With Quote
Old 11-03-2006, 11:30 AM   PM User | #2
ess
Regular Coder

 
Join Date: Oct 2006
Location: United Kingdom
Posts: 865
Thanks: 7
Thanked 29 Times in 28 Posts
ess will become famous soon enough
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
ess is offline   Reply With Quote
Old 11-03-2006, 08:20 PM   PM User | #3
urgido
Regular Coder

 
Join Date: Aug 2005
Posts: 257
Thanks: 8
Thanked 0 Times in 0 Posts
urgido is an unknown quantity at this point
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:

PHP Code:
session_name('the_ID');
session_start();
$my_id "?the_ID=".$_SESSION['the_ID']; 
and on my Link:
PHP Code:
<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 is offline   Reply With Quote
Old 11-03-2006, 09:02 PM   PM User | #4
urgido
Regular Coder

 
Join Date: Aug 2005
Posts: 257
Thanks: 8
Thanked 0 Times in 0 Posts
urgido is an unknown quantity at this point
solved!

session_id(); is my solution. Regards
urgido is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:13 AM.


Advertisement
Log in to turn off these ads.