#####
1,NO cache 的方法:
print "Content-type: text/html\n\n";
print "Pragma:no-cachenn";
#----------------------------------
2.检查非法字符:
if ($A{'ID'}=~/[||<|>|s+|\|/|?|*|$|n|r|&]/){
print "输入信息中含有非法字符<P>程序终止";
exit0;}
#——————————————————
3.查email及homeUrl
$useremail="" if (!($useremail =~ /.*@.*..*/));
$userurl ="" if (!($userurl =~ /.*:.*..*/ ));
#=====================================================
4.sub decode { #解码
local($return)=$_[0];
$return =~ tr/+/ /;
$return =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
return $return;
}
##########
5. #去掉html标记
sub filterhtml {
local($return)=$_[0];
$return =~ s/<!--(.|n)*-->//g;
if ($allow_html != 1) {
$return =~ s/<([^>]|n)*>//g;
$return =~ s/<//g;
}
return $return;
}
#######################################
6. #取时间日期
($secn,$minn,$hourn,$dayn,$monn,$yearn,$weekn,$yeardayn,$isdst) = localtime(time+(3600*$time_miss));
$monn=$monn+1;
if ($monn<10) {$monn="0$monn";}
if ($dayn<10) {$dayn="0$dayn";}
if ($hourn<10) {$hourn="0$hourn";}
if ($minn<10) {$minn="0$minn";}
if ($secn<10) {$secn="0$secn";}
$daten="$yearn/$monn/$dayn";
$timen="$hourn:$minn:$secn";
$newuserno="$yearn$monn$dayn$hourn$minn$secn";
}
#########
#从文件读出数据
sub readtxtfile {
open(READTXTFILE,"$_[0]");
@readtxtfile=<READTXTFILE>;
close(READTXTFILE);
return @readtxtfile;
}
#############
#查空
sub checkempty {
local($chkval)=$_[0];
$chkval =~ s/ ||n//g;
&error($_[1]) if ($chkval eq "");
}
##########