Jump to content


Photo

php sessions


  • Please log in to reply
4 replies to this topic

#1 gamernaveen

gamernaveen
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 16 July 2006 - 10:20 AM

Please someone help me.
i dont know y ppl use SID in url while they can retrieve with session_start().
Can some one tell me? 8) ??? ??? ??? ??? ??? ??? ;)

#2 Joe Haley

Joe Haley
  • Members
  • PipPipPip
  • Advanced Member
  • 103 posts
  • LocationCanada, eh?

Posted 16 July 2006 - 10:22 AM

session_start() creates a session or resumes the current one based on the current session id that's being passed via a request, such as GET, POST, or a cookie.

From the PHP manual: http://ca.php.net/ma...ssion-start.php

SID in a url is a way of passing a session id.
Give a man a fish; you have fed him for today.  Teach a man to fish; and you have fed him for a lifetime
Don't teach men to program. Teach them to fish.

Please, try the RTFM solution before asking for help:
http://php.net/manual/en/index.php

#3 gamernaveen

gamernaveen
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 16 July 2006 - 10:26 AM

example i have two users in my site,
Now i have defined some vars abt their profiles.
Now if i dont use sid , both the visitors see the same profile.
If i use sid , each visitor views his own profile . Right?
Is it like that? am confused.!!!! ??? ??? ??? ??? :( :( :( ::) ::) ::)

#4 Joe Haley

Joe Haley
  • Members
  • PipPipPip
  • Advanced Member
  • 103 posts
  • LocationCanada, eh?

Posted 16 July 2006 - 10:33 AM

A session is a way of keeping data between page requests.

You have 2 main parts to a session:
A session ID, and the data that corrosponds to that session id.

A user is given a session ID somehow (eg: a cookie, in the url, ext) and the server keeps track of what data corrposponds to that session id.

The data is kept server-side, and the only thing the user gets is the session id that corrosponds to the data.

When you see something like: "www.whatever.com/file.ext?sessionid=12345abc" It is a way of telling the server "hi, im mr.12345abc." The server can then acsees the stored information corrosponding to that session id, work with it, and output stuff to the user. Session ids are carried 3 ways: Get, Post, and Cookie. Get = in the URL, post = from a form, cookie = in a cookie.
Give a man a fish; you have fed him for today.  Teach a man to fish; and you have fed him for a lifetime
Don't teach men to program. Teach them to fish.

Please, try the RTFM solution before asking for help:
http://php.net/manual/en/index.php

#5 gamernaveen

gamernaveen
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 16 July 2006 - 10:38 AM

Thanks.  ;) 8) :-*




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users