note 74928 deleted from security.globals by tularis
| From: | tularis@php.net | Date: | Fri, 04 May 2007 17:23:38 +0000 |
| Subject: | note 74928 deleted from security.globals by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126198@lists.php.net to get a copy of this message | ||
Note Submitter: jfunk
----
You can accidentally poison some session variables yourself if you aren't careful. When
debugging someone else's code I found an inadvertent overwrite
<?
//$_SESSION['name'] is used as the logged in user's name for greetings on several
pages
echo "Hello $_SESSION[name]";
...
//The the user uses a form to add a new user
$name = "$_POST[name]";
$result= mysql_query("INSERT INTO user SET name = '$name'")
?>
$_SESSION['name'] is overwritten because the programmer used $name as a variable and then
wrote to it.