;
close(DEF);
foreach $line(@datas) {
if ($line eq '') { next; }
@defs = split(/\|/,$line,4);
push(@LOADER,$defs[0]);
if ($defs[3]=~/N/g) {
if ($in{$defs[0]} eq '') {;CgiErr('>>|有些欄位是一定要填寫的,請再檢查一次!!'); }
}
if($defs[3]=~/E/g){
unless ($in{$defs[0]}=~/.+\@.+..+..+/) { $in{$defs[0]} = ''; }
}
if($defs[3]=~/W/g){
unless ($in{$defs[0]}=~/http:\/\/.+\..+\..+/) { $in{$defs[0]} = ''; }
}
if($defs[1] eq 'textarea'){
if ($in{'html'} ne 'y') {
$in{$defs[0]} =~s/</g;
$in{$defs[0]} =~s/>/>/g;
$in{$defs[0]} =~s/"/"/g;
}
$in{$defs[0]} =~s/\cM//g;
$in{$defs[0]} =~s/\n\n//g;
$in{$defs[0]} =~s/\n/
/g;
}
if(($defs[1] eq 'select')||($defs[1] eq 'radio')){
unless ($defs[2]=~/$in{$defs[0]}/g) { CgiErr('>>|CGI 參數傳遞錯誤!!'); }
}
}
return @LOADER;
}
sub WriteData{ #mon/dd/yy-hh/mim/ss
local ($e,$date,@e,$count);
local($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$mon++;
if ($use_time == 1) { $date = "$mon/$mday/$year-$hour:$min:$sec"; }
else{ $date = "$mon/$mday/$year";}
chop($date) if ($date =~ /\n/);
open(D,$guestdata);
@e = ;
close(D);
($count,$_) = split(/&&/,$e[$#e]);
$count++;
open(DATA,">>$guestdata");
print DATA "$count&&";
foreach $e (@LOADER) {
print DATA "$data{$e}&&";
}
print DATA "$date\n";
close(DATA);
return $count ;
}
sub PrintOK{
local ($c) = $_[0] if @_;
local ($t,$e);
print "Thank You!! ^_^\n";
print "★謝謝您在版上留下寶貴的意見!!★\n";
print "◇您的意見已加入站上的留言板了,您是第 $c 位留言者!!
\n";
print "您的資料如下:\n";
print "
\n";
foreach $e (@LOADER) {
if ($data{$e}) {print "▲$e | $data{$e}\n"; }
}
print " |
回訪客留言板\n";
}