Skip to content

Instantly share code, notes, and snippets.

@danilowm
Created March 8, 2012 01:56
Show Gist options
  • Save danilowm/1997988 to your computer and use it in GitHub Desktop.
Save danilowm/1997988 to your computer and use it in GitHub Desktop.
Função Anti SQL Injection
<?php
/*
* Anti Injection
* Verifica e Trata as informações
* Autor: Danilo Iannone - [email protected]
*/
function anti_injection( $obj ) {
$obj = preg_replace("/(from|alter table|select|insert|delete|update|where|drop table|show tables|#|*|--|\\)/i", "", $obj);
$obj = trim($obj);
$obj = strip_tags($obj);
if(!get_magic_quotes_gpc()) {
$obj = addslashes($obj);
return $obj;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment