Re: Re: Cookies and Variables

From: Date: Tue, 20 Nov 2001 22:47:16 +0000
Subject: Re: Re: Cookies and Variables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-75315@lists.php.net to get a copy of this message
Keep it mind that EGPCS is in that order for a reason. Changing it can open up security problems... -JAson Garbeeeeeeeer At 01:16 PM 11/20/2001 -0800, Fred wrote:
If you want certain variables to over ride cookie variables you need to change the setting of the variables_order directive in php.ini: variables_order string Set the order of the EGPCS (Environment, GET, POST, Cookie, Server) variable parsing. The default setting of this directive is "EGPCS". Setting this to "GP", for example, will cause PHP to completely ignore environment variables, cookies and server variables, and to overwrite any GET method variables with POST-method variables of the same name. Fred Richard S. Crawford <rscrawford@mossroot.com> wrote in message news:5.1.0.14.0.20011120124940.02ff5308@pop3.norton.antivirus... Consider this code, in page1.php: <?php
         setcookie("someWord","I am a cookie");
?> ...and this code, in page2.php: <?php
         setcookie("someWord",$someWord);
         print ("someWord says: $someWord");
         $someWord = "I am a variable";
         print ("< a href=\"page2.php?someWord=$someWord\" >Click here< /a
"); ?> (In the actual code, the value of $someWord is passed via POST through a form, but the principle is the same.) The first time I load page2.php, the output should be:
         someWord says: I am a cookie
Which, of course, works perfectly. But each subsequent time I load page2.php, I want the output to be:
         someWord says: I am a variable
and then set the value of the cookie "someWord" to "I am a variable". But that's not what happens. Everytime I load page2.php, someWord tells me that it is a cookie. How do I get the value of the variable to override the value of the cookie? Sliante, Richard S. Crawford http://www.mossroot.com AIM: Buffalo2K ICQ: 11646404 Y!: rscrawford MSN: underpope@hotmail.com "It is only with the heart that we see rightly; what is essential is invisible to the eye." --Antoine de Saint Exupéry "Push the button, Max!" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net


« previous php.general (#75315) next »