note 6238 modified in Session handling functions by sas
| From: | sas@php.net | Date: | Thu, 17 Aug 2000 21:18:34 +0000 |
| Subject: | note 6238 modified in Session handling functions by sas | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-2234@lists.php.net to get a copy of this message | ||
<b>Editor's note:</b> This is a security feature. You shall not trust data coming
from clients.<p>
Remember that you CANNOT override a EXISTING session variable with a FORM(post), e.g.:
<BR><BR>
First page:
<?
$something = "blah";
session_register("something");
?>
<form method="post">
<input type="text" name="something">
</post>
<br><br>
And let's say you typed "fla fla" in the something field.
<br><br>
Second page:
<?
SESSION_REGISTER("something");
$something = $something;
echo $something;
?>
<BR><BR>
The second page will return "blah". You cann't override an existing session variable
with a HTTP POST Variable.
<BR><BR>
Correct (second page):
<?
SESSION_REGISTER("something");
$something = $HTTP_POST_VARS["something"];
echo $something;
?>
<br><br>
This will return the value you inserted into the input field.
http://www.php.net/manual/session-handling-functions.php