Manipulating PHP's session cookie with JavaScript: Possible?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John Drako

    Manipulating PHP's session cookie with JavaScript: Possible?

    Short Question:

    is there a Javascript library that can decode and encode data into the
    format used by PHP sessions stored in the session cookie?

    The longer version:

    I'm creating a fairly complex interactive application (wizard like)
    using PHP and storing the data from various steps in a session.

    I would like to be able to mirror the functionality in javascript on the
    client side so that the interaction between the browser and the server
    is minimal if possible. The javascript version would be to make the
    application faster (user-perception-wise) in between steps and at the
    end hands the data to the server.

    I googled for few hours and failed to find the answer.

    So, is there a Javascript library that would allow me to read and
    manipulate the data in the session cookie on the client's side?

    Or at least is there some documentation how the data is encoded in the
    session by PHP?

  • Oli Filth

    #2
    Re: Manipulating PHP's session cookie with JavaScript: Possible?

    John Drako said the following on 11/11/2005 18:04:[color=blue]
    > Short Question:
    >
    > is there a Javascript library that can decode and encode data into the
    > format used by PHP sessions stored in the session cookie?
    >[/color]

    All the session cookie contains is a UID string, something like:

    qdsvoht043urc9f 2l81illdk04

    The session data itself is stored on the server.

    PHP uses the UID to identify which set of session data relates to which
    current user.

    --
    Oli

    Comment

    • Colin McKinnon

      #3
      Re: Manipulating PHP's session cookie with JavaScript: Possible?

      John Drako wrote:
      [color=blue]
      >
      > Or at least is there some documentation how the data is encoded in the
      > session by PHP?[/color]

      The seesion data is not stored in the cookie - the cookie holds a reference
      (handle) to data stored on the server.

      C.

      Comment

      • Ciphex .Ï€

        #4
        Re: Manipulating PHP's session cookie with JavaScript: Possible?

        You might try to use an AJAX style javascript function to talk to the
        PHP backend on your server.
        That way Javascript could update the information on your page using the
        data stored on the server and your user would never see a page refresh
        and thus perceive quick functionality.

        Google around for PHP AJAX and you will find all the info you could want.

        -ci


        Comment

        Working...