Jump to content

prevention of db injection?


ollie007

Recommended Posts

u can use strip tags and that will remove any html tags. instead of strip slashes you want to use addslashes that way it will put an escape character in front of quotes. ie turning 'hello world' into \'hello world\'. another alternative is using htmlspecialchars or htmlentities if you want to keep the tags intact. these will just change the html characters into there respective character codes.

Link to comment
Share on other sites


function escape_string ($string) {
if(version_compare(phpversion(),"4.3.0")=="-1") {
	return mysql_escape_string($string);
} else {
	return mysql_real_escape_string($string);
}
}

 

what I use and it doesn't call php function it calls extension.mysql.dll file which requires you to have a connection to database (no idea why).. but yah. thats it

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.