Jump to content

PHP security...I have a hole somewhere.


guyfromfl

Recommended Posts

I have an old db class that I created a while ago, and might switch to PDO.  I just don't want to recode the whole site.

 

The class was working really well to protect my db but they (spammers) have found a way around all my security and are posting links to porn, pills and russian.

 

What I have is in the db class, there is a query function.  Every query is sent to this function where it is sanitized and checks a table of blocked ips.

 

I belive they are somehow bipassing this and going directly to the data base, becasue I am getting attacks from the same IP that should be blocked.

 

The function looks something like this:

function query($sql) {
	if ($this->checkIp($_SERVER['REMOTE_ADDR'])) {
		$sql = $this->sanitize($sql);
		$result = mysql_query($sql);

		return $result;
	}
	else
	{
		die("<h1>You are banned for abuse!</h1>");
	}
}

 

Does anybody have any suggestions?

Link to comment
https://forums.phpfreaks.com/topic/229037-php-securityi-have-a-hole-somewhere/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.