note 99881 added to function.mysql-real-escape-string
| From: | ricardo at ricardotorres dot co dot uk | Date: | Sun, 12 Sep 2010 21:50:08 +0000 |
| Subject: | note 99881 added to function.mysql-real-escape-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-172500@lists.php.net to get a copy of this message | ||
That's what I do:
<?php
function clean($str) {
$str = @trim($str);
if(get_magic_quotes_gpc()) {
$str = stripslashes($str);
}
return mysql_real_escape_string($str);
}
?>
And then:
<?php
$username = clean($_POST['username']);
$password = clean($_POST['password']);
?>
Assuming - of course - that you have an open link with the database.
----
Server IP: 69.147.83.197
Probable Submitter: 78.105.71.68
----
Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php
Edit -- https://master.php.net/note/edit/99881
Del: integrated -- https://master.php.net/note/delete/99881/integrated
Del: useless -- https://master.php.net/note/delete/99881/useless
Del: bad code -- https://master.php.net/note/delete/99881/bad+code
Del: spam -- https://master.php.net/note/delete/99881/spam
Del: non-english -- https://master.php.net/note/delete/99881/non-english
Del: in docs -- https://master.php.net/note/delete/99881/in+docs
Del: other reasons-- https://master.php.net/note/delete/99881
Reject -- https://master.php.net/note/reject/99881
Search -- https://master.php.net/manage/user-notes.php