Manipulating PHP's session cookie with JavaScript: Possible?
Question posted by: John Drako
(Guest)
on
November 11th, 2005 06:25 PM
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?
3
Answers Posted
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
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.
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
|
|
|
What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 196,795 network members.
Top Community Contributors
|