<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1041042" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1041042</link>
    <description></description>
    <language>en</language>
          <item>
    <title>According to PHP.net that is</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/mysql-injection-tests-login-box#comment-1229750</link>
    <description> &lt;p&gt;According to PHP.net that is depreciated, and does not escape % and _. &lt;/p&gt;
&lt;p&gt;Besides, if you are using mysql_real_escape you are doing a database query, and if you are doing a database query you have a connection.&lt;/p&gt;
&lt;p&gt;The three are a package, and without a DB connection and a query, the escape is pointless.&lt;br /&gt;
And they will work on and update the real_escape, as the other one is depreciated it wont receive improvements.&lt;/p&gt;
&lt;p&gt;Also, I think the fact it escapes the string according to the database&#039;s current character set makes it more robust and less likely to give an error.&lt;/p&gt;
&lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;php.net wrote:&lt;/strong&gt;&lt;br /&gt;
mysql_escape_string() does not take a connection argument and does not respect the current charset setting.&lt;/p&gt;
&lt;p&gt;This function became deprecated, do not use this function. Instead, use mysql_real_escape_string().&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;So in my opinion you should use real_escape.&lt;/p&gt;
 </description>
     <pubDate>Wed, 23 Apr 2008 22:56:09 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1229750 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>If you want to escape the</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/mysql-injection-tests-login-box#comment-1229731</link>
    <description> &lt;p&gt;If you want to escape the string before connecting to the database, you can use mysql_escape_string().  This function is probably safe to use as long as your database doesn&#039;t use some funky charset.&lt;/p&gt;
&lt;p&gt;See &lt;a href=&quot;http://www.webmaster-forums.net/web-database-development/mysql-real-escape-string&quot; class=&quot;bb-url&quot;&gt;this thread&lt;/a&gt; for more info.&lt;/p&gt;
 </description>
     <pubDate>Tue, 22 Apr 2008 18:02:46 +0000</pubDate>
 <dc:creator>pr0gr4mm3r</dc:creator>
 <guid isPermaLink="false">comment 1229731 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>Glad to help.
One other</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/mysql-injection-tests-login-box#comment-1229707</link>
    <description> &lt;p&gt;Glad to help.&lt;/p&gt;
&lt;p&gt;One other thing I will mention, a lesson I learned recently.&lt;br /&gt;
The mysql_real_escape_string() function needs a database connection FIRST to actually work.&lt;br /&gt;
Something about it using the database char set for it&#039;s escape parameters (something like that).&lt;/p&gt;
&lt;p&gt;So have the mysql_connect() and mysql_select_db() before you escape the strings. I found it returns an error if you don&#039;t, and as with all PHP errors it halts the PHP script completely so stops the page working/loading.&lt;/p&gt;
 </description>
     <pubDate>Sun, 20 Apr 2008 18:01:45 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1229707 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>That&#039;s a great explanation</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/mysql-injection-tests-login-box#comment-1229705</link>
    <description> &lt;p&gt;That&#039;s a great explanation as always, thanks &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Sun, 20 Apr 2008 16:50:08 +0000</pubDate>
 <dc:creator>drew22299</dc:creator>
 <guid isPermaLink="false">comment 1229705 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title>If you used</title>
    <link>https://www.webmaster-forums.net/web-programming-and-application-development/mysql-injection-tests-login-box#comment-1229700</link>
    <description> &lt;p&gt;If you used mysql_real_escape_string on any variables you run through the query then you don&#039;t really need to check it.&lt;br /&gt;
That function will &quot;escape&quot; certain chars in a string like &#039; &quot; etc so they are read as text only.&lt;br /&gt;
So regardless of what a user types in an input box where that input data is stored in a variable and used in a query, it will only ever be used as text, so it can&#039;t change your query.&lt;/p&gt;
&lt;p&gt;So if a user enters into an input field &#039; OR &#039;1=1&#039; , instead of it changing your query to - where username = &#039;&#039; OR &#039;1=1&#039;&lt;br /&gt;
The actual string will contain the TEXT - &#039;&#039; OR 1=1&#039;&#039;&lt;br /&gt;
So it is now looking for a user called by the name: &#039;&#039; OR 1=1&#039;&#039;&lt;br /&gt;
(&quot;single quote space OR 1 = 1 single quote)&lt;/p&gt;
&lt;p&gt;I suppose you could test it by entering that data into your DB as a username to test see if it does find a username by that name. If it finds a user called: &#039;&#039; OR 1=1&#039;&#039;   then you know it works fine.&lt;/p&gt;
&lt;p&gt;You could also test it by trying to change the query yourself to look for something you know exists.&lt;/p&gt;
&lt;p&gt;So if you have a username in the DB called &quot;drew&quot;, type this in your input box&lt;br /&gt;
&#039; OR &#039;drew&#039;&lt;br /&gt;
It shouldnt work if you escaped the string first, as it will be looking for a username called: &#039; OR &#039;drew&#039;&lt;br /&gt;
(single quote OR single quote drew single quote)&lt;/p&gt;
&lt;p&gt;I never really test that far as I put all vars that go through the query through real_escape_string first, I just trust it as I know how escaping chars in PHP works.&lt;/p&gt;
&lt;p&gt;This might help you&lt;br /&gt;
&lt;a href=&quot;http://www.tizag.com/mysqlTutorial/mysql-php-sql-injection.php&quot; title=&quot;http://www.tizag.com/mysqlTutorial/mysql-php-sql-injection.php&quot;&gt;http://www.tizag.com/mysqlTutorial/mysql-php-sql-injection.php&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And lots of other info&lt;br /&gt;
&lt;a href=&quot;http://www.securiteam.com/securityreviews/5DP0N1P76E.html&quot; title=&quot;http://www.securiteam.com/securityreviews/5DP0N1P76E.html&quot;&gt;http://www.securiteam.com/securityreviews/5DP0N1P76E.html&lt;/a&gt;&lt;/p&gt;
 </description>
     <pubDate>Sun, 20 Apr 2008 03:43:02 +0000</pubDate>
 <dc:creator>greg</dc:creator>
 <guid isPermaLink="false">comment 1229700 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
