Skip to content

Instantly share code, notes, and snippets.

View rafaelfoster's full-sized avatar

Rafael Foster rafaelfoster

View GitHub Profile
@rafaelfoster
rafaelfoster / phpAntiSQLInjection.php
Last active December 27, 2015 15:19 — forked from danilowm/gist:1997988
Function in PHP that receives the parameters (normaly passed by a $_POST or a $_GET and treat the informations removing some SQL commands, preventing the 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", "",strtolower($obj));
$obj = trim($obj);