GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 11-Jul-2002, 11:52
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough

PHP Sessions question


my GIDTopsites script is 85% ready... it was built from the ground up (so MAJOR personal achievement for me)

but i am stuck trying to get the sessions to work (if the user has NOT enabled cookies). so, i want the session id to be 'passed' through the url instead but don't know how - any ideas?
  #2  
Old 15-Jul-2002, 18:58
Garth Farley Garth Farley is offline
Invalid Email Address
 
Join Date: May 2002
Location: Ireland
Posts: 638
Garth Farley is a jewel in the roughGarth Farley is a jewel in the roughGarth Farley is a jewel in the rough
OK, as far as I know the developers of PHP thought of this and have included a compile-time directive "--enable-trans-sid" which automatically appends the session id to the URL if the user has cookies turned off. How you test for this, I don't really know, but if it hasn't been happening for you, then I guess it's not there.

Also in php.ini there'll be an option to enable it. If you can, set it to

session.use_trans_sid = 1

If your host has this disabled, I heard there is a way of overriding this through your .htaccess files. I'll do more research & see if it's true.

Otherwise you'll just have to do it the old fashioned way.

Just call session_id() to obtain the session id. Then you'll have to append it manually to each link you create in a page - best left to a function really as it'll get very repetitive. So

Code:
$sid = session_id(); echo "<a href="http://www.desilva.net/topsites/blah.php?sid=$sid">Every link</a>";

You also have to worry about naming the session so that PHP won't create a brand spanking new session every time. Call the function session_name() before session_start() to reference the users session like so:

Code:
session_name($sid); //where $sid is the session_id passed thru the URL session_start(); //Starts up the right session

I hope this helps. Please note that I'm assuming register_globals = off.

Garth Farley
  #3  
Old 16-Jul-2002, 04:58
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
yes, u're right, i ACTUALLY got the session appended to the url (automatically) when I tested it for the first time - this despite my browser generally accepting cookies!

then, on the 2nd try, i lost it and it got inside a cookie and i cannot get it back despite switching cookies off for my browser.

so far, no one has reported any problems logging-in and staying logged in so i assume it's working on the LIVE server.

thanks anyway...
 

Recent GIDBlogPrepping for deployment by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about loading php into tables or css pcxgamer Web Design Forum 6 17-Sep-2005 21:08
Optimizing your web server with Turck MMCache for PHP JdS Web Hosting Forum 2 07-Jan-2004 07:48
apache2 - php cgi fehler - schleife inna Apache Web Server Forum 8 27-Nov-2003 09:55
[Linux] Installing PHP --with-mcrypt JdS Web Hosting Forum 0 20-Aug-2003 08:40
All the big PHP script collections that matter jrobbio MySQL / PHP Forum 5 06-Jun-2003 16:14

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 16:15.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.