Thread: session

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    0
    Rep Power
    0
    I've converted from asp to php, but I can't find out about the sessions.......

    Can someone tell me how to "turn them on".

    bjorn
  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    Are you using PHP4? Sessions are not supported in PHP3 (though you can install PHPLIB -- I don't have the URL at my fingertips but do a search for that and you'll find it).

    Sessions can be started explicitly with:

    session_start();

    or implicitly with:

    session_register('var_name');

    You must one of the above on each page where you wish to access session variables.
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    0
    Rep Power
    0
    I'm using PHP4.

    I've tryed to use the session_start() but I get the warning : "Warning: Cannot send session cookie - headers already sent" and the same with the cache limiter.

    it seems like I am able to create the session. I echo the session_id() after starting a session, but how can I keep the sessionID. I haven't figured out the <?=$SID?> which should be put at the end of links. I get $SID?> from the HTTP_GET_VARS.

    I guess I haven't got the hang of PHP sessions yet....



    [This message has been edited by bjorngb (edited September 29, 2000).]
  6. #4
  7. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    session_start() has to be called before ANY output, either HTML directly or via print, echo, etc.

    If you don't have short tags enabled than the <?= syntax won't work and you'll need to use <?PHP print $SID ?>

Similar Threads

  1. refreshing page on session
    By xlordt in forum PHP Development
    Replies: 3
    Last Post: August 26th, 2003, 04:28 PM
  2. reading existing session, problem
    By buttie in forum Perl Programming
    Replies: 7
    Last Post: August 11th, 2003, 11:26 AM
  3. session start issue!
    By djl in forum PHP Development
    Replies: 0
    Last Post: July 29th, 2003, 02:37 PM
  4. PATH_INFO URL - Search Engine Friendly
    By Coopercentral2 in forum PHP Development
    Replies: 2
    Last Post: April 19th, 2003, 11:44 PM
  5. anonFTP hack?
    By (jp) in forum FTP Help
    Replies: 3
    Last Post: March 10th, 2003, 02:58 PM

IMN logo majestic logo threadwatch logo seochat tools logo