程式碼(輸入字串是 IP 位址)
function proc_str($instr){
$pattern = '([^0-9\.])';
$replacement = '';
$instr = preg_replace($pattern, $replacement, $instr);
return ereg_replace("&#", "", htmlspecialchars(str_replace("'", "\\'", stripslashes($instr))));
}
程式碼
function proc_str($instr){
$pattern = '([^0-9a-zA-Z\-\_])';
$replacement = '';
$instr = preg_replace($pattern, $replacement, $instr);
return ereg_replace("&#", "", htmlspecialchars(str_replace("'", "\\'", stripslashes($instr))));
}
No comments:
Post a Comment