RE: [PHP4BETA] session variables [quite long]
| From: | Richard Feather | Date: | Fri, 13 Aug 1999 17:40:47 +0000 |
| Subject: | RE: [PHP4BETA] session variables [quite long] | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-3400@lists.php.net to get a copy of this message | ||
Hmmm. Did you
global $s_var1, $s_var2, $s_var3;
on page 3?
Richard Feather
Vice President, Production
Origin Interactive Inc.
1743 Wazee St.
Denver, CO 80202
ph. 303.382.5470 | fax 303.382.5469
______________________________
The world's most dangerous sig line...
-----Original Message-----
From: Christophe Lauer [mailto:clauer@sqli.fr]
Sent: Friday, August 13, 1999 11:14 AM
To: php4beta@lists.php.net
Subject: [PHP4BETA] session variables [quite long]
Hi,
*** Yet another "session variables" question, please, do not flame, and
consider spending 5 mins to read this message ***
We are preparing a comparative test (benchmark) for multiple web
development environments.
So far, we've used commercial application servers, Jserv, mod_perl, and
we're now on PHP4. We're using a quadri PIII-500 and a bi PII-450 with
each 1Go ram ;-)) Overkill...
Summary of the results will be publically available from our US partner
company website.
Btw, if you have hints on optimizations, it'd be good to show all those
sceptic people what PHP4 can really do (i've seen some messages about a
Zend optimizer/complier feature in PHP4, but have no idea on how to use
it. Does it really exists ?).
I don't manage to understand how session variables work with PHP4, so i
tell you what i actually do, and if someone could point me to the right
direction, i'd really much appreciate.
I run a debian slink with kernel 2.2.11, Apache and, of course, PHP4 B1
as an apache module.
When i get it working, i'll write a memo so that none has to re-ask the
same about session variables. Code would be too long to post in this
message, i just need a theorical explanation, for the rest, i'll go on
hacking. Of course, if you had a small sample code near you, that'd be
great.
1st Page :
First, i create a new session, using session_start() at the top of my
first page, since this function will set a cookie, i need it to execute
before the http headers are send by Apache.
From then, a call to session_id() returns me a cryptic session
identifier. So far, it seems all right.
Then, the rest of this first page contains a simple HTML Form with 3
input fields and a submit linking to my second page. Let's say my fields
are called var1 through var3. I use a POST method. Is the POST method
ok, or do i have to use a GET ?
I click on the submit button, this leads me to the 2nd page...
2nd page :
My form values are in $var1, $var2 and $var3. I want to keep these
values in session variables called $s_var1, $s_var2 and $s_var3. So i
write :
session_register("s_var1");
session_register("s_var2");
session_register("s_var3");
$s_var1 = $var1 ;
$s_var2 = $var2 ;
$s_var3 = $var3 ;
As far as i have understood, this is enough to save the values. I see
these values kept in /tmp/<sid>, so it seems to be ok.
I click to follow the link to the 3rd page...
3rd page :
Here i want to display my session variables values.
I simply do an echo in order to display the contents of $s_var1 through
$s_var3 : Here is my question : I get nothing. Should i ? What did i
forgot or did not understand ?
Thank you to all who did not commit suicide before the end of my
message, i bet some sentences may not be really clear...
Regards from Paris,
Christophe Lauer
--
Christophe Lauer
R&D - SQLi
http://www.sqli.fr/online
--
PHP 4 Beta