//-----------------------------------------------------------------------------------
-------
//-----------------------------------------------------------------------------------
-------
// Function name: AlertExit($C_alert,$I_goback=0)
// Function: Illegal operation warning
// Parameter: $C_alert (Error message prompted)
//$I_goback (return to that page)
// Return value: string
// Note: None
//-----------------------------------------------------------------------------------
-------
function AlertExit($C_alert,$I_goback=0)
{
if($I_goback<>0)
{
echo "<script>alert('$C_alert');($I_goback);</script>";
exit;
}
else
{
echo "<script>alert('$C_alert');</script>";
exit;
}
}
//-----------------------------------------------------------------------------------
-------
//-----------------------------------------------------------------------------------
-------
// Function name: ReplaceSpacialChar($C_char)
// Function: Special character replacement function
// Parameter: $C_char (string to be replaced)
// Return value: string
// Note: None
//-----------------------------------------------------------------------------------
-------
function ReplaceSpecialChar($C_char)
{
$C_char=HTMLSpecialChars($C_char); //Convert special characters to HTML format.
$C_char=nl2br($C_char); //Replace Enter with<br>
$C_char=str_replace(" "," ",$C_char); //Replace space with
$C_char=str_replace("<? ","< ?",$C_char); //Replace PHP tag
return $C_char;
}
//-----------------------------------------------------------------------------------
-------
//-----------------------------------------------------------------------------------
-------
// Function name: ExchangeMoney($N_money)
// Function: Fund conversion function
// Parameter: $N_money (the amount to be converted)
// Return value: string
// Note: Example of this function: $char=ExchangeMoney(5645132.3155) ==>
$char='¥5,645,132.31'
//-----------------------------------------------------------------------------------
-------
function ExchangeMoney($N_money)
{
$A_tmp=explode(".",$N_money ); //Divide the number into two parts by the decimal point and save it into the array $A_tmp
$I_len=strlen($A_tmp[0]); //Measure the width of the number of digits before the decimal point
if($I_len%3==0)
{
$I_step=$I_len/3; //If the width of the previous digits mod 3 = 0, you can press it and divide it into $I_step
part
}else
{
$step=($len-$len%3)/3+1; //If the width of the previous digits mod 3 != 0, you can press it and divide it into $I_step
Part +1
}
$C_cur="";
//Convert the amount before the decimal point
while($I_len<>0)
{
$I_step--;
if($I_step==0)
{
$C_cur .= substr($A_tmp[0],0,$I_len-($I_step)*3);
}else
{
$C_cur .= substr($A_tmp[0],0,$I_len-($I_step)*3).",";
}
$A_tmp[0]=substr($A_tmp[0],$I_len-($I_step)*3);
$I_len=strlen($A_tmp[0]);
}
//Convert the amount after the decimal point
if($A_tmp[1]=="")
{
$C_cur .= ".00";
}else
{
$I_len=strlen($A_tmp[1]);
if($I_len<2)
{
$C_cur .= ".".$A_tmp[1]."0";
}else
{
$C_cur .= ".".substr($A_tmp[1],0,2);
}
}
//Add RMB symbol and send it out
$C_cur="¥".$C_cur;
return $C_cur;
}
//-----------------------------------------------------------------------------------
-------
//-----------------------------------------------------------------------------------
------
// Function name: WindowLocation($C_url,$C_get="",$C_getOther="")
// Function: Functions in PHP
// Parameter: $C_url The URL of the turn window
//$C_get GET method parameters
// Other parameters of the $C_getOther GET method
// Return value: String
// Note: None
//-----------------------------------------------------------------------------------
-----
function WindowLocation($C_url,$C_get="",$C_getOther="")
{
if($C_get == "" && $C_getOther == "")
if($C_get == "" && $C_getOther <> ""){$C_target=""='$C_url?
$C_getOther='+"";}
if($C_get <> "" && $C_getOther == ""){$C_target=""='$C_url?
$C_get'"";}
if($C_get <> "" && $C_getOther <> ""){$C_target=""='$C_url?
$C_get&$C_getOther='+"";}
return $C_target;
}
//-----------------------------------------------------------------------------------
-----
?>