escape($value); //If there is an SQL Connection, else $value = addslashes($value); //$QUERY[$key] = htmlspecialchars($value); $QUERY[$key] = $value; } } return $QUERY; } /** * This function will undo the damage made by magic quotes. This will go thru the request array and unescape all the data. * Argument : $param_array - [OPTIONAL] The array that must be unescaped. If empty, the function uses $_POST + $_GET * $ignore_magic_quote_setting - [OPTIONAL] If set to true, this will escape the given array no matter what the get_magic_quotes_gpc() returns. Defaults to 'true' * Return : The proper format of the array - unescaped. */ function unescapeQuery($param_array = array(),$ignore_magic_quote_setting = false) { $PARAM = array(); if(!$param_array) $param_array = $_POST + $_GET; //Don't use $_REQUEST - it has cookie/session info in it. if(!$ignore_magic_quote_setting and !get_magic_quotes_gpc()) return $param_array;//If Magic quotes is disabled, just return the data - it is not escaped. while(list($key,$value) = each($param_array)) { if(is_array($value)) { //UnEscape Arrays recursively $PARAM[$key] = unescapeQuery($value,$ignore_magic_quote_setting); //:RECURSION: } else { $PARAM[$key] = stripslashes($value); } } return $PARAM; } /** * Prints a array, an object or a scalar variable in an easy to view format. * Arguments : $data - the variable that must be displayed * Link : http://www.bin-co.com/php/scripts/dump/ */ function dump() { $args = func_get_args(); $count = count($args) - 1; print "
";
if($count) print "-------------------------------------------------------------------------------------------------------------------\n";
foreach($args as $data) {
if(is_array($data) or is_object($data)) { //If the given variable is an array, print using the print_r function.
if(!$count) print "-----------------------\n";
if(is_array($data)) print_r($data);
else var_export($data);
if(!$count) print "-----------------------\n";
else print "=======================================================\n";
} else {
print "=========>";
print var_dump($data);
print "<=========\n"; } } if($count) print "-------------------------------------------------------------------------------------------------------------------"; print "\n"; } //http://php.net/autoload function __autoload($class_name) { require_once $class_name . '.php'; }