preping data for compare after using sqls mysql_real_escape_string($userName)

This is a discussion on preping data for compare after using sqls mysql_real_escape_string($userName) within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I took care of my sql injection problem but all my strings are quoted now as you know. So how ...


Go Back   Usenet Forums > PHP Programming Forums > alt.comp.lang.php

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 07-20-2007
Kevin Raleigh
 
Posts: n/a
Default preping data for compare after using sqls mysql_real_escape_string($userName)

I took care of my sql injection problem but all my strings are quoted now as
you know.

So how do I prep my username which has quotes in the db but not in my code,
so that I can compare it to the db?
// makes sure they filled it in
if(!$_POST['username'] || !$_POST['pass']) {
die('You did not fill in a required field.');
}

// checks it against the database

$check = mysql_query("SELECT * FROM user WHERE username =
'".$_POST['username']."'")or die(mysql_error());

I tried addslashes();
and I tried to use the mysql_real_escape_string($userName)
but ...
insight appreciated
thank you
kevin


Reply With Quote
  #2 (permalink)  
Old 07-20-2007
Kevin Raleigh
 
Posts: n/a
Default Re: preping data for compare after using sqls mysql_real_escape_string($userName)


"Kevin Raleigh" <kraleigh@sbcglobal.net> wrote in message
news:5bydnU4QCKjvjT3bnZ2dnUVZ_vmlnZ2d@giganews.com ...
> I took care of my sql injection problem but all my strings are quoted now

as
> you know.
>
> So how do I prep my username which has quotes in the db but not in my

code,
> so that I can compare it to the db?
> // makes sure they filled it in
> if(!$_POST['username'] || !$_POST['pass']) {
> die('You did not fill in a required field.');
> }
>
> // checks it against the database
>
> $check = mysql_query("SELECT * FROM user WHERE username =
> '".$_POST['username']."'")or die(mysql_error());
>
> I tried addslashes();
> and I tried to use the mysql_real_escape_string($userName)
> but ...
> insight appreciated
> thank you
> kevin
>
>


Problem resolved, and it was a problem...

Thank You
Kevin


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 12:05 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0