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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.