1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
<?php
define("XH_PARAM_INT",0);
define("XH_PARAM_TXT",1);
function PAPI_GetSafeParam($t_Val, $pi_Def = "", $pi_iType = XH_PARAM_TXT)
{
// INT
if ( XH_PARAM_INT == $pi_iType)
{
if (is_numeric($t_Val))
return $t_Val;
else
return $pi_Def;
}
// String
$t_Val = str_replace("&", "&",$t_Val);
$t_Val = str_replace("<", "<",$t_Val);
$t_Val = str_replace(">", ">",$t_Val);
if ( get_magic_quotes_gpc() )
{
$t_Val = str_replace("\\\"", """,$t_Val);
$t_Val = str_replace("\\''", "'",$t_Val);
}
else
{
$t_Val = str_replace("\"", """,$t_Val);
$t_Val = str_replace("'", "'",$t_Val);
}
return $t_Val;
}
?>
|