Re: [PHP] Sessions Header PROBLEM again!
Hi, thank you for your attention This is only a sample to understand how the session work, in order to use them in a more complex web applications The goal is verify how to pass the var $count through each of the three pages by the php session function Particularly, when as usually, a client has the session/cookies disabled Call First.php $count=1 Go to the Second.php, here $count would be always = 1 (but with session disabled $count stay not defined) Go to the Third.php == always $count=1 (but with session disabled $count stay not defined) Go to the First.php $count=2 (with session disabled $count is always =1) and go on 1) Ok is a writing mistake 2) I delete the hidden variable 'count' in the form, but the pb is not solved yet 3) The final php script has more fork I had to use header(Location...) 4) Yes!!! Is only a sample :-) 5) Deleted the hidden var Why with session enabled all is OK and with session disabled all is KO??? Bye bye Alessandro Steve Cayford wrote: Don't know offhand what the problem is, but a couple thoughts: 1. Why are you using session_name(mysession) instead of session_name('mysession')? 2. Assuming you have register_globals on, you're trying to pass $count both as a session variable and a post variable. One of these is going to get overwritten by the other if I'm not mistaken. 3. Why not have the page 1 form action point directly at page 2 instead of being redirected through page 1? Do posted variables follow a redirect? 4. If posted variables do follow a redirect then page 1 will see that $submit is set and redirect to page 2, which will redirect to page 3, which will redirect to page 1, etc... Can you get an infinite redirection loop? 5. The form on page 1 includes a hidden count variable, page 2 and page 3 don't. What happens when you run this? -Steve On Friday, November 2, 2001, at 08:49 AM, Alessandro BOSSI wrote: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Sessions Header PROBLEM again!
Why in these 3 linked page the var count does not go through the page if I have the browser sessions disabled??? Where is the mistake? I see the session_id, changing at every page! Someone can help me? Many thank Alessandro Bossi - ?php /* First.php */ session_name(mysession); session_start(); session_register (count); if (isset($submit)){ header(Location: Seconda.php?.SID); }else{ $count++; } print session_encode= .session_encode().BR; ? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTMLHEADTITLE First Page/TITLE/HEAD BODY BGCOLOR=#A2BBAF H4First Page/H4 Hello visitor, you have seen this page ?=$count; ? times.p count = ?= $HTTP_SESSION_VARS[count] ?BR P FORM METHOD=POST ACTION=?= $PHP_SELF ? INPUT TYPE=hidden NAME=count value=?=$count? INPUT TYPE=submit name=submit value=Go to the SECOND page /FORM /BODY/HTML - ?php /* Second.php */ session_name(mysession); session_start(); session_register('count'); if (isset($submit)){ header(Location: Third.php?.SID); } print session_encode= .session_encode().BR; ? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTMLHEADTITLESecond Page/TITLE/HEAD BODY BGCOLOR=#A2BBAF H4Second Page/H4 Hello visitor, you have seen this page ?=$count; ? times.p count = ?= $HTTP_SESSION_VARS[count] ? P FORM METHOD=POST ACTION=?= $PHP_SELF ? INPUT TYPE=submit name=submit value=Go to the THIRD Page /FORM /BODY /HTML - ?php /* Third.php */ session_name(mysession); session_start(); session_register (count); if (isset($submit)){ header(Location: First.php?.SID); } print session_encode= .session_encode().BR; ? !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN HTML HEAD TITLEThird Page/TITLE /HEAD BODY BGCOLOR=#A2BBAF H4Third Page/H4 Hello visitor, you have seen this page ?=$count; ? times.p Count = ?= $HTTP_SESSION_VARS[count] ? P FORM METHOD=POST ACTION=?= $PHP_SELF ? INPUT TYPE=submit name=submit value=Go to the FIRST Page /FORM /BODY /HTML -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]