Commit 0692b9e6 authored by Tim Schoondergang's avatar Tim Schoondergang
Browse files

Correctie Clean4DB

parent 99919829
{
"name": "timmit/db-mysql",
"description": "A simple DB layer in PHP for using MySQL",
"version": "v1.0.5",
"version": "v1.0.6",
"license": "MIT",
"homepage": "http://www.TiMMiT.nl/",
"authors": [
......
......@@ -170,27 +170,25 @@ namespace TiMMiT\MySQL;
/**
* Clean variable for DB against SQL injection
* @param string $var
* @param string $value
* @param boolean $key default false
* @return string
*/
public static function Clean4DB($var) {
//if(get_magic_quotes_gpc()){
// $var = stripslashes($var);
//}
return addcslashes(mysqli_real_escape_string(self::$mlink,$var), "%_");;
public static function Clean4DB($value,$key=false) {
$value = addcslashes(mysqli_real_escape_string(self::$mlink,$value), "%_");
if($key!=false){
$value = str_replace('\_',"_",$value);
}
return $value;
}
/**
* Clean variable from DB against slashes against SQL injection
* @param string $value
* @param boolean $key default false
* @return string
*/
public static function CleanFromDB($value,$key=false) {
public static function CleanFromDB($value) {
$value = stripcslashes($value);
if($key!=false){
$value = str_replace('\_',"_",$value);
}
return $value;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment