Reply
SQL Injection?
Old 08-16-2005, 01:56 PM SQL Injection?
Extreme Talker

Posts: 219
Location: UK, East Anglia
What is the best way to stop it, i'm currently using mysql_real_escape_string() on every thing that comes in contact with a query. Is this enough to prevent attacks? Or should i be doing something else as well?
timsquash5 is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 08-16-2005, 07:42 PM
AxE
AxE's Avatar
Skilled Talker

Posts: 62
Good question, Id like to know this too.

I usually just use trim(mysql_real_escape_string($var)); and ive not had any trouble, but then again, my site isnt exactly popular at the moment :P or at least, not polular enough to have a random attempt at taking it down :P
AxE is offline
Reply With Quote
View Public Profile
 
Old 08-17-2005, 07:38 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
get_magic_quotes_gpc() along with addslashes() normaly does the trick.

I dont care what people say about turning get_magic_quotes_gpc off for basically when it is on you will provide that extra bit of security to your system.

E.G

No magic quotes:
if your post data $password = "apass" OR 1="1";
then
select * from users where password=$password will get every user's details. If magic quotes are on it will fail with no results.

trim, addslashes etc and all those other methods are sounds and its advisable for us to use them. But simply leave magic_quotes_gpc on and your almost protected. ALMOST.

If your extremly paranoid you can break down user input and scan it for bad sql.

Basically trust nothing your users post you.

Ibbo
__________________
www.nationalclubgolfer.com www.sportspub.co.uk www.bespokecc.co.uk www.centralmarquees.co.uk
Linux user #349545 :
(GNU/Linux)iD8DBQBAzWjX+MZAIjBWXGURAmflAKCntuBbuKCWenpm XoA7LNydllVQOwCf
ibbo is offline
Reply With Quote
View Public Profile Visit ibbo's homepage!
 
Reply     « Reply to SQL Injection?
 

Thread Tools

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

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




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12676 seconds with 12 queries