Theoritical question about SESSION

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agun
    New Member
    • Oct 2008
    • 16

    Theoritical question about SESSION

    Hi guys,

    Sorry for asking something that maybe already obvious to you all. But since i'm newbie, i just need further explanation. (I've read the PHP Sessions thread written by Atli)

    In my head, i figured out that actually a session variable is only somekind of global array variable stored in server that works in entire of our site (every page that need the session variable can access it).

    So is it the same thing if i develop a technique that passing variables from one page to another page ? But of course, session makes it very simple.

    In short, my question is :

    session variable = regular variable that passed to every page?

    ---
    Another question is :

    Can we set the session time-out specifically on each page (so the time-out for page A would be different from B) instead of setting it globally in php.ini ?


    Thank you very much.
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    question one: yes (it's a superglobal like $_GET & $_POST)

    question two: all I can think of to set an expiry time in the session after that the session will destroy itself by a (custom) function.

    note: I've not yet worked with sessions, but that's how I'd do it

    regards

    Comment

    • dlite922
      Recognized Expert Top Contributor
      • Dec 2007
      • 1586

      #3
      Originally posted by agun

      session variable = regular variable that passed to every page?
      Yes

      Originally posted by agun
      Can we set the session time-out specifically on each page (so the time-out for page A would be different from B) instead of setting it globally in php.ini ?
      Yes. On Page A, before session_start() use ini_set() to change the timeout value.

      This overrides what is in the php.ini file.


      Good luck,




      Dan

      Comment

      • trochia
        New Member
        • Oct 2008
        • 19

        #4
        I am also playing with sessions for the first time, but unable to get it write to the DB table

        I had found this, and now here to research also sessions....and am heading here:
        (I've read the PHP Sessions thread written by Atli)
        thank's to this thread.

        Hope the below helps all.

        Jim



        PS.. I don't mean to be "hijacking" as someone said, but face it...without advance search functions ( per specific forum etc) There's going to be a lot of pages to search thru/...or am I missing something?n ( for an advanced search on this site) ??
        Last edited by pbmods; Oct 22 '08, 02:04 AM. Reason: Fixed Link.

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Originally posted by trochia
          PS.. I don't mean to be "hijacking" as someone said, but face it...without advance search functions ( per specific forum etc) There's going to be a lot of pages to search thru/...or am I missing something?n ( for an advanced search on this site) ??
          You are, but it's not your fault; I don't think there's a single link on this site to the search functionality. But here it is.

          Comment

          Working...