SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jun 2001
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SID -- is it useful??

    Hi folks,

    I am new to php's sessions and was wondering whether I should be using them for my site. I've implemented sessions in php before by passing the id in each link, or as a hidden form field. It would be nice to use the in-built session stuff, but I'm worried about users who don't accept cookies.

    I noticed that if a user doesn't accept cookies, then sessions will set the constant SID, which can be appended to all links, (my understanding is that php can be set to do this automatically, but I haven't figured out how...). But my main concern is that when a user hits the reload button a new session id is generated. Is there any fail-safe way to avoid this?

    In general would you say that sessions are worth it if you have to restrict it to cookie eaters?

    Also... anybody know of any estimates of the percentage of users who don't accept cookies?

    thanks much,
    john

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hitting the reload button should not generate a new session id. In order to automatically append SID to the url if the user has cookies turned off, your php needs to be compiled with the following directive
    --enable-trans-sid

    I usually just put a disclaimer in my site somewhere that says in order to use this site correctly you need to have cookies turned on.
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    SitePoint Member
    Join Date
    Jun 2001
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks freddy,

    I do seem to get new sessions when I reload a test page I set up, with cookies turned off. I'm guessing it's because the first line in my page is session_start(). But don't I need to call session_start in order to use sessions? Am I doing this incorrectly???

    thanks also for the tip on compiling php with --enable-trans-sid. I ran phpinfo() and found that session.use_trans_sid is set to 1, so I was guessing that this was already set. But perhaps this refers to something else altogether?

    john
    p.s. just had a hard time posting this reply... I had turned off cookies to test my page. Apparently sitepoint requires cookies too


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •