- Joined
- May 18, 2008
- Messages
- 1,943
- Reaction score
- 446
PHP:
Anti SQL Injection Script:
[CODE][COLOR="SandyBrown"]// Anti-SQL Injection[/COLOR]
function check_inject()
{
$badchars = array(";", "'", "\"", "*", "DROP", "SELECT", "UPDATE", "DELETE", "-");
foreach($_POST as $value)
{
if(in_array($value, $badchars))
{
die("SQL Injection Detected\n<br />\nIP: ".$_SERVER['REMOTE_ADDR']);
**
else
{
$check = preg_split("//", $value, -1, PREG_SPLIT_OFFSET_CAPTURE);
foreach($check as $char)
{
if(in_array($char, $badchars))
{
die("SQL Injection Detected\n<br />\nIP: ".$_SERVER['REMOTE_ADDR']);
**
**
**
**
** [/CODE]
Last edited: