Re: help with session
| From: | Dan | Date: | Fri, 31 Aug 2007 22:30:13 +0000 |
| Subject: | Re: help with session | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261574@lists.php.net to get a copy of this message | ||
You should be sanatizing code here. When you save it to the session and when it's output. Look arround the newsgroups or online for info about it, it's everywhere.
- Dan
"mike" <mike503@gmail.com> wrote in message news:bd9320b30708260318m2649fc91o24e8132938d16f88@mail.gmail.com...
On 8/26/07, Jason Cartledge <jason1096@hotmail.co.uk> wrote: I would replace $_REQUEST with $_GET or $_POST (as appropriate)if ( !empty($_REQUEST['gender']) )Personally I would use if(isset($_SESSION['registrationGender'])) here{ $registrationGender=$_REQUEST['gender']; } else {if (session_is_registered('registrationGender')) { $registrationGender=$_SESSION['registrationGender']; print "you are preregistered as a $registrationGender"; } else { print "your gender is unknown, youare assumed to be a male";$_SESSION['registrationGender']='male';I would change it to assign it here. No need to assign it a second time below, since you are just printing the session variable if it is already setThose are a couple quick things my tired bloodshot eyes thought of.} }