1
I’m using the function GetSQLValueString
of dreamweaver
to validate some variables and everything works well, but doing a test with the program Acunetix Web Vulnerability Scanner 9.5
I came across an error message provided by him, accusing a possible security breach.
The url generated by the program and the message is this:
http://meusite.com.br/cidades.ajax.php?ajax=true&search=&uf[]=27
PHP Warning: mysql_real_escape_string() expects Parameter 1 to be string, array Given in E: home topdeia Web n-chipi cidades.ajax.php on line 22
That’s the job of:
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, is there any way around that mistake?
Always is a Uf only?
– rray
Hello @rray, yes, it will always be one UF at a time, in this case the UF is being invoked by clicking on an area of a map for display of representatives.
– adventistapr