securing user input
| From: | Adv. Systems Design | Date: | Fri, 25 Aug 2000 20:54:16 +0000 |
| Subject: | securing user input | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-2385@lists.php.net to get a copy of this message | ||
Hi:
I am new to php but found this in a script and I think
I understand what it does...it takes all user input
(if you used post in the form) and adds slashes to
protected chars...are the "cleaned" vars returned to
HTTP_POST_VARS?... further, it goes into the array and
removes <>|...but what if you are searching for ">"?
Once you have added slashes, do you really need to
kill those bad chars? Does anyone have a routine they
would like to share that also checks size (to avoid
buffer issues?).
for (reset($HTTP_POST_VARS);
$key = key($HTTP_POST_VARS);
next ($HTTP_POST_VARS)) {
$this = addslashes ($HTTP_POST_VARS[$key]);
$this = strtr($this, ">", " ");
$this = strtr($this, "<", " ");
$this = strtr($this, "|", " ");
$$key = $this;
}
Thanks
Luis
__________________________________________________
Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/