Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server
You last visited: Today at 05:00

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Need to know how to prevent Sql Injection

Discussion on Need to know how to prevent Sql Injection within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
marlyandedsel's Avatar
 
elite*gold: 0
Join Date: Aug 2010
Posts: 343
Received Thanks: 21
Need to know how to prevent Sql Injection

Any one knows how? I just need to learn it how with explanation guys, or some example to do script, I have google it and I found something but I need another from here, I know someone knows how to explain it well.
marlyandedsel is offline  
Old 09/03/2012, 18:29   #2
 
badguy4you's Avatar
 
elite*gold: 0
Join Date: May 2008
Posts: 477
Received Thanks: 178
Escaping is the word

You Must prevent user from entering characters that is mainly used in DB Queries

I will give you an example of how the process is done

you have a simple DB Query like

Quote:
SELECT * FROM Accounts WHERE Name = 'badguy4you'
if you let users enter the ' symbol, they can exploit it to get other infromation like turning the above query to something like

Quote:
SELECT * FROM Accounts WHERE Name = 'badguy4you' AND Age = '31'
So you can simply do Escaping on any user input [that interferes with the DB] to prevent this exploit

this is just a brief for you, of course you can find a lot on the internet, JUST GOOGLE IT !
badguy4you is offline  
Thanks
2 Users
Old 09/03/2012, 18:34   #3
 
shadowman123's Avatar
 
elite*gold: 0
Join Date: Aug 2007
Posts: 1,525
Received Thanks: 230
Check this Link

shadowman123 is offline  
Thanks
1 User
Old 09/04/2012, 17:21   #4
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,161
I wrote a simple function that parse queries and make them safe for one kind of SQL-injections. It's PHP, but as a programmer I'm sure you'll understand it.

Code:
function safe_query($query="") {
	global $_mysql_querys;
	if(stristr(str_replace(' ', '', $query), "unionselect")===FALSE AND stristr(str_replace(' ', '', $query), "union(select")===FALSE){
		$_mysql_querys[] = $query;
		if(empty($query)) return false;
		if(DEBUG == "OFF") $result = mysql_query($query) or die('Query failed!');
		else {
			$result = mysql_query($query) or die('Query failed: '
			.'<li>errorno='.mysql_errno()
			.'<li>error='.mysql_error()
			.'<li>query='.$query);
		}
		return $result;
	}
	else die();
}
_Emme_ is offline  
Thanks
2 Users
Reply


Similar Threads Similar Threads
[Guid] How To Protect Your Web Site Prevent Sql Injection [Guid]
08/07/2012 - SRO Private Server - 97 Replies
hello epvp members this tutorial original by me and im going to show you how to protect your site from sql injection let's start question:What is Sql Injection !? answer:A SQL injection attack attempts to compromise your database by creating SQL commands that are executed instead of, or in addition to, the commands that you have built into your application. What Can Be Done to Prevent an SQL Injection !!
Maybe to Prevent a Ban
08/06/2009 - Silkroad Online - 0 Replies
Hello , i got today the "wrong version" error and found out , that when the error comes , the pc connects to IP:121.128.134.16 PORT:15080 it still connects to this ip , i´ve deleted my silkerrsender long time before but it still connects to this ip if a error comes ( like the wrong version error ) so , i think it would be better if you block those ip at your hosts file or firewall i tested it , blocked it in hosts , firewall and router , silkroad connects normaly so its not an...
What's a dc?How to prevent it?
05/03/2009 - Silkroad Online - 39 Replies
Hello everyone Nothing ever bothered me in Sro like Getting disconnected .. especially lately (last year -_-) because servers are much more crowded than ever so i was wondering .. what's a dc? do i lose connection with server or is it a technical fault from joymax? .. What's its causes? Slow internet connection? slow pc? too much downloading and stuff?running multiclients? Am using a duo core proessor with a 512Mb vga and 3Gb of ram and 512 Mb dsl connection though ... and still gets lots of...



All times are GMT +2. The time now is 05:00.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.