I'm using the GetSQLValueString
function of dreamweaver
to validate some variables and everything works fine, but running a test with the Acunetix Web Vulnerability Scanner 9.5
program I came across an error message provided by it, accusing a possible breach of security.
The url generated by the program and the message is this:
PHP Warning: mysql_real_escape_string () expects parameter 1 to be string, array given in E: \ home \ topdeia \ Web \ n-chipi \ cities.ajax.php on line 22
The function is this:
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
The question is, do you have to get around this error?