Connecting Tech Pros Worldwide Forums | Help | Site Map

Manipulating PHP's session cookie with JavaScript: Possible?

John Drako
Guest
 
Posts: n/a
#1: Nov 11 '05
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
Guest
 
Posts: n/a
#2: Nov 11 '05

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:

qdsvoht043urc9f2l81illdk04

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
Colin McKinnon
Guest
 
Posts: n/a
#3: Nov 11 '05

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.
Ciphex .π
Guest
 
Posts: n/a
#4: Nov 22 '05

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


Closed Thread


Similar PHP bytes