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.

PHP Forum


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



Freelance Jobs

Reply
Old 02-10-2008, 01:47 PM SQL Injection
Sharon_leic's Avatar
Super Talker

Posts: 115
Name: Sharon
Location: Leicester, uk
Trades: 0
$name = $_POST['name']; $name = mysql_real_escape_string($name);

Is the above enough to remove any injection or is there anything else that should be done also?

should i remove slashes?

how about get_magic_quotes_gpc ?

thanks Shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!

Last edited by Sharon_leic; 02-10-2008 at 01:49 PM..
Sharon_leic is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-10-2008, 03:03 PM Re: SQL Injection
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
See Example#3 A "Best Practice" query at http://us3.php.net/mysql_real_escape_string

See http://us3.php.net/manual/en/securit...-injection.php

See http://www.webmaster-talk.com/php-fo...must-read.html (which has a link to a thread about SQL Injection -- the linked-to thread listed here is a sticky, so it's a good pointer to check those out)
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 02-10-2008, 08:02 PM Re: SQL Injection
Sharon_leic's Avatar
Super Talker

Posts: 115
Name: Sharon
Location: Leicester, uk
Trades: 0
Thanks for that JeremyMiller
i have used all in the examples and seems to be working fine

Is there anyone here that wants to try a MySQL injection on my database as i don't know how? i have it fully backed up and only my profile in it.
i can send the url by pm if you want to try?

thanks

Shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
Sharon_leic is offline
Reply With Quote
View Public Profile
 
Old 02-10-2008, 10:09 PM Re: SQL Injection
Sharon_leic's Avatar
Super Talker

Posts: 115
Name: Sharon
Location: Leicester, uk
Trades: 0
Would anyone be prepared to spend a couple of mins to try sql injection for me?

i can give you the url by pm as long as you don't laugh! lol

Shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
Sharon_leic is offline
Reply With Quote
View Public Profile
 
Old 02-10-2008, 11:23 PM Re: SQL Injection
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Send me the URL I'll check it
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 02-10-2008, 11:39 PM Re: SQL Injection
Sharon_leic's Avatar
Super Talker

Posts: 115
Name: Sharon
Location: Leicester, uk
Trades: 0
Thanks!

its coming now

Shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
Sharon_leic is offline
Reply With Quote
View Public Profile
 
Old 02-11-2008, 11:59 AM Re: SQL Injection
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
Same i will have a go
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 02-11-2008, 01:41 PM Re: SQL Injection
Sharon_leic's Avatar
Super Talker

Posts: 115
Name: Sharon
Location: Leicester, uk
Trades: 0
URL on the way but don't laugh!
its my first php site and far far from complete yet lol

it survived NullPointer's attack so hopefully it will yours to lol

Thanks

Shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!

Last edited by Sharon_leic; 02-11-2008 at 01:45 PM..
Sharon_leic is offline
Reply With Quote
View Public Profile
 
Old 02-11-2008, 02:00 PM Re: SQL Injection
dansgalaxy's Avatar
Defies a Status

Posts: 6,521
Name: Dan
Location: Swindon
Trades: 0
im crap at sql injection lol did nullpointer try using the encoded chars i know u can use them which gets past the mysql_real_escape func
__________________
Discounted Web Hosting With XDnet!
>> Get 25% of hosting~ Promo: Webmaster-talk <<

Please login or register to view this content. Registration is FREE
dansgalaxy is offline
Reply With Quote
View Public Profile Visit dansgalaxy's homepage!
 
Old 02-11-2008, 02:05 PM Re: SQL Injection
Sharon_leic's Avatar
Super Talker

Posts: 115
Name: Sharon
Location: Leicester, uk
Trades: 0
Quote:
Originally Posted by dansgalaxy View Post
im crap at sql injection lol did nullpointer try using the encoded chars i know u can use them which gets past the mysql_real_escape func
not sure what he used

but to stop injection, i used

mysql_real_escape_string
get_magic_quotes_gpc

and then added some other code to look for certain symbols

hopefully it will be enough lol

i am making the actual profile pages now and just writing the bit for picture upload so i have to watch security on that to now hehe

thanks for trying

Shaz x
__________________
mysql_connect("localhost", "brain", "sharon") or die(mysql_error());
mysql error: brain doesn't exist!
Sharon_leic is offline
Reply With Quote
View Public Profile
 
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.39214 seconds with 12 queries