note 74928 added to security.globals
| From: | jfunk at osu1 dot php dot net | Date: | Fri, 04 May 2007 17:10:50 +0000 |
| Subject: | note 74928 added to security.globals | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126195@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 69.147.83.197
Probable Submitter: 72.8.104.15
----
Manual Page -- http://www.php.net/manual/en/security.globals.php
Edit -- https://master.php.net/note/edit/74928
Del: integrated -- https://master.php.net/note/delete/74928/integrated
Del: useless -- https://master.php.net/note/delete/74928/useless
Del: bad code -- https://master.php.net/note/delete/74928/bad+code
Del: spam -- https://master.php.net/note/delete/74928/spam
Del: non-english -- https://master.php.net/note/delete/74928/non-english
Del: in docs -- https://master.php.net/note/delete/74928/in+docs
Del: other reasons-- https://master.php.net/note/delete/74928
Reject -- https://master.php.net/note/reject/74928
Search -- https://master.php.net/manage/user-notes.php