Kann man mysql_real_escap_string so lose verwenden:
$user=$_POST["user"]
$user=mysql_real_escape_string($user);
$pw=$_POST["pw"]
$pw=mysql_real_escape_string($pw);
mysql_query("INSERT INTO kunde set user='$user',pw='$pw' ")
(ist das so sicher?)
oder geht mysql_real_escape_string nur in einer Querry wie
$query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'",
mysql_real_escape_string($user),
mysql_real_escape_string($password));
mysql_real_escape_string richtig setzen
Re: mysql_real_escape_string richtig setzen
Die erste Version kann man verwenden, wobei eine entsprechende Function oder Class deutlich flexibler wäre.
PayPal.Me/JoeUser ● FreeBSD Remote Installation
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
Wings for Life ● Wings for Life World Run
„If there’s more than one possible outcome of a job or task, and one
of those outcomes will result in disaster or an undesirable consequence,
then somebody will do it that way.“ -- Edward Aloysius Murphy Jr.
-
Roger Wilco
- Posts: 5923
- Joined: 2004-05-23 12:53
Re: mysql_real_escape_string richtig setzen
Ich frage mich schon seit geraumer Zeit, weshalb sich Leute immer noch selbst SQL-Queries zusammenbauen, statt einfach Prepared Statements zu verwenden…
