Re: switch it button

From: Date: Wed, 23 Aug 2006 14:32:43 +0000
Subject: Re: switch it button
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-241049@lists.php.net to get a copy of this message
Ford, Mike wrote:
How about something like: <a href="<?php echo $_SERVER['PHP_SELF'] ?>?session_switch=<?php $_GET['session_switch']?0:1 ?>">switch</a>
Beware that PHP_SELF is injectable like several other $_SERVER variables, so you must at least encode it to prevent XSS attacks. Eg. http://example.com/foo.php/"></a><script>alert('xss here');</script Passing it through htmlspecialchars() will encode it safely, but in this case you can just omit it. href="?foo=bar" is perfectly valid and works fine. Arpad

« previous php.general (#241049) next »