Google Groups Home
Help | Sign in
mysql_real_escape_string
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
mlugert  
View profile
 More options 14 May, 16:41
From: mlugert <mlug...@yahoo.com>
Date: Wed, 14 May 2008 08:41:46 -0700 (PDT)
Local: Wed 14 May 2008 16:41
Subject: mysql_real_escape_string
Sorry if this has been answered, but when using Doctrine what should
we do to protect against sql injection?  mysql_real_escape_string
doesn't always make sense if you are using other DBs.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mlugert  
View profile
 More options 14 May, 17:02
From: mlugert <mlug...@yahoo.com>
Date: Wed, 14 May 2008 09:02:18 -0700 (PDT)
Local: Wed 14 May 2008 17:02
Subject: Re: mysql_real_escape_string
Of course I mean when using DQL specifically.

On May 14, 10:41 am, mlugert <mlug...@yahoo.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mlugert  
View profile
 More options 14 May, 17:21
From: mlugert <mlug...@yahoo.com>
Date: Wed, 14 May 2008 09:21:11 -0700 (PDT)
Local: Wed 14 May 2008 17:21
Subject: Re: mysql_real_escape_string
Found the answer for those who care.  Doctrine uses PDO which
internally uses PDO::quote();  In short Doctrine takes care of this
and there is no need for mysql_real_escape_string.

On May 14, 11:02 am, mlugert <mlug...@yahoo.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
colnector (colnect.com)  
View profile
 More options 15 May, 09:18
From: "colnector (colnect.com)" <webmas...@colnect.com>
Date: Thu, 15 May 2008 01:18:22 -0700 (PDT)
Local: Thurs 15 May 2008 09:18
Subject: Re: mysql_real_escape_string
Please note that mysql_real_escape_string()  [and I assume
PDO::quote() though I don't use it] take care only of escaping the
query string thus does not prevent SQL injections completely. You
should always check any user input.

BAD example:
$userID = $_GET['user'];
$sql = 'SELECT * FROM users WHERE id='.$userID;

Now consider what happens if the parameter given is:
0 OR email=this.guy.h...@hotmail.com

In this example it's easy to use:
$userID = intval($_GET['user']);
if (!$userID || $userID > UPPER_LIMIT || $userID < LOWER_LIMIT) {
  ....

}

On May 14, 7:21 pm, mlugert <mlug...@yahoo.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google