Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



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

Posts: 219
Location: UK, East Anglia
Trades: 0
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
 
 
Register now for full access!
Old 08-16-2005, 08:42 PM
AxE
AxE's Avatar
Skilled Talker

Posts: 62
Trades: 0
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, 08:38 AM
ibbo's Avatar
Super Spam Talker

Posts: 880
Location: Leeds UK
Trades: 0
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
__________________

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

Please login or register to view this content. Registration is FREE

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 Search this Thread
Search this Thread:

Advanced Search

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 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.23901 seconds with 12 queries