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 03-12-2003, 07:59 PM   PM User | #1
LaundroMat
New Coder

 
Join Date: Oct 2002
Location: Ghent, Belgium
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
LaundroMat is an unknown quantity at this point
Question On sessions...

The php manual is not too clear on sessions, and after tinkering with it, I still have some questions:[list=a][*]Does a session_start() look for previous sessions on the users computer (ie cookies)?[*]In order to initialize a session variable (say: $_SESSION["Admin"] = False) each time a user visits a page for the first time, do I have to call session_unset()?[*]I started a page with session_start(), but echo SID returns an empty string. How comes?[/list=a]

I thought session variables had to be passed on "manually", either via cookies or via the URL. It seems as if PHP decides for itself whether to keep the values inside a session variable.
__________________
Those innocent fun games of the hallucination generation

Last edited by LaundroMat; 03-12-2003 at 08:01 PM..
LaundroMat is offline   Reply With Quote
Old 03-13-2003, 11:37 AM   PM User | #2
Ökii
Regular Coder

 
Join Date: Jun 2002
Location: UK
Posts: 577
Thanks: 0
Thanked 0 Times in 0 Posts
Ökii is an unknown quantity at this point
session_start sort of looks for a client cookie
in reality the client cookie data is sent with the http request for the page - so session_start really only assigns the data to $_SESSION variables ready for the script to access.

check your phpinfo() and find out what the session id name is - it might well be something different to SID (there are numerous variants)

you shouldn't need session_unset - as $_SESSION['admin'] = false; would overwrite any existing value of the session var 'admin'
__________________
Ökii - formerly pootergeist
teckis - take your time and it'll save you time.
Ökii is offline   Reply With Quote
Old 03-14-2003, 01:24 PM   PM User | #3
LaundroMat
New Coder

 
Join Date: Oct 2002
Location: Ghent, Belgium
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
LaundroMat is an unknown quantity at this point
Thumbs up

Aha! Thanks. All has been fixed now
__________________
Those innocent fun games of the hallucination generation
LaundroMat 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 05:09 AM.


Advertisement
Log in to turn off these ads.