Return to Snippet

Revision: 49673
at August 7, 2012 09:19 by n19ht


Updated Code
function clean_array_for_post($post){
	foreach($post as $key => $value){
		if(get_magic_quotes_gpc()) $post[$key] = stripslashes($value);
		if(!is_numeric($value)) $post[$key] = mysql_real_escape_string($value);
		$post[$key] = strip_tags($value);
    }
    return $post;
}

Revision: 49672
at November 23, 2011 01:00 by n19ht


Updated Code
function clean_array_for_post($post){
	foreach($post as $key => $value){
		if(get_magic_quotes_gpc()) $post[$key] = stripslashes($value);
		if(!is_numeric($value)) $post[$key] = mysql_real_escape_string($value);
    }
    return $post;
}

Revision: 49671
at July 28, 2011 02:12 by n19ht


Initial Code
function clean_array_for_post($post){
	foreach($post as $key => $value){
		if(get_magic_quotes_gpc()){
			$post[$key] = stripslashes($value);
		}
		if(!is_numeric($value)){
			$post[$key] = mysql_real_escape_string($value);
		}
	}
	return $post;
}

Initial URL


Initial Description
Esta funcion limpia un array contra inyección SQL.

Initial Title
Limpiar variables $_POST/$_GET contra SQL Injection PHP

Initial Tags
sql, php

Initial Language
PHP