[PHP] Using $_SESSION vs. session_register

Sharky Forums


Results 1 to 3 of 3

Thread: [PHP] Using $_SESSION vs. session_register

Threaded View

  1. #1
    Ex-*** kid A's Avatar
    Join Date
    Sep 2000
    Location
    Norway
    Posts
    5,322

    Question [PHP] Using $_SESSION vs. session_register

    I have a large-ish backend that I made with the (now deprecated) session_register, session_is_registered, session_unset, session_destroy functions.

    Now I've made a frontend for that backend using the superglobal $_SESSION instead, setting session variables like so:

    PHP Code:
    $_SESSION["UID"] = $row['userid'];
    $_SESSION["LAST_TS"] = $row['last_login']; 
    after these are set, the login script redirects to the site frontpage (using the header function), where I check these variables to decide what parts to display. However I can't access them / they are empty! I know that they do get set though, because I can access the backend without logging in there as well (same credentials), and I can also logout successfully (using unset()). So I'm wondering why are they not available to me on the frontpage?

    I did read in the PHP manual that you are not supposed to use the old session functions with the new $_SESSION superglobal, but I don't in the frontend scripts. I do in use these functions in the backend but they are not really connected.. they include the same headers.php file, and functions pages, but these don't use session variables, just session_start() and ob_start().

    If I've made myself understood, are there any suggestions?
    Last edited by kid A; 10-05-2004 at 01:20 PM.
    Now listening to various rock and metal
    143rd member to join Sharkyforums.

Posting Permissions

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