Re: Using mysql_real_escape_string without connecting to mysql

From: Date: Thu, 24 Jan 2008 22:39:52 +0000
Subject: Re: Using mysql_real_escape_string without connecting to mysql
References: 1 2 3 4 5 6 7 8 9 10 11  Groups: php.general 
Request: Send a blank email to php-general+get-268046@lists.php.net to get a copy of this message
On Thu, January 24, 2008 12:03 pm, Dotan Cohen wrote: > On 24/01/2008, Richard Lynch <ceo@l-i-e.com> wrote: >> It is NOT safe from, say, XSS attack if $evilString contains an XSS >> snippet and you re-display it on your site. >> >> In other words, you should still filter the INPUT somewhere; But you >> are escaping the output to MySQL so that it is not going to execute >> arbitrary SQL on your DB server. > > After I pull the info out of the database, before it goes to the > webbrowser, it goes through this: > > function clean_html ($dirty) { > $dirty=strip_tags($dirty); The strip_tags should probably have been done before it ever went into the database, as part of INPUT FILTERING rather than escaping output... > $clean=htmlentities($dirty); > return $clean; > } > > Dotan Cohen > > http://what-is-what.com > http://gibberish.co.il > א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-× -ס-×¢-×£-פ-×¥-צ-×§-ר-ש-ת > > A: Because it messes up the order in which people normally read text. > Q: Why is top-posting such a bad thing? > -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/from/lynch Yeah, I get a buck. So?

« previous php.general (#268046) next »