($sec,$min,$hour,$mday,$mon,$year)=localtime(time); $mon = $mon+1; $year = $year+1900; $filepath = "../guestbook"; $cgi_url = "/cgi-bin/pigguest.pl"; #本CGI的絕對路徑 $datapath = "$filepath/data/"; #用戶數据文件的位置 $photopath = "$filepath/icon/"; #圖片路徑 $adminame = "admin"; #版主用戶名 $admipass = "abc123"; #版主密碼 $user = "flowerpig"; #如果本項不為空則為多用戶模式關閉 $adminmail = "flowerpig\@yeah.net"; #當多用戶模式開啟時本項無用 $adminurl = "http://flowerpig.126.com"; #當多用戶模式開啟時本項無用 $title ="花斑豬CGI工厂留言板"; #當多用戶模式開啟時本項無用 $pagenum = 10; #每頁多少記錄 $allow_html = 0; #是否支持Html, 默認為0, 不允許 $page = 1; #默認頁 $work = "look"; #如果沒有參數, 就為查看模式 $backcolor = "#3988B3"; #背景顏色 $formbackcolor = "#0080FF"; #表格背景顏色 $linkcolor = "#FFFF00"; #鏈接顏色 $textcolor = "#00FFFF"; #文本顏色 $topimage = "$filepath/image/top.gif"; #頂部的banner文件名 ####################################################### read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($allow_html == 0) { $value =~ s///g; $value =~ s/<([^>]|\n)*>//g; } $FORM{$name} = $value; } @querys = split(/&/, $ENV{'QUERY_STRING'}); foreach $query (@querys) { ($name, $value) = split(/=/, $query); $FORM{$name} = $value; } if ($user eq "") #多用戶模式是否開啟 { $user = $FORM{'user'}; #多用戶模式開啟 } print "Content-type: text/html\n\n"; print < $title EOF if ($FORM{'work'} ne "") { $work = $FORM{'work'}; } if ($FORM{'page'} ne "") { $page=$FORM{'page'}; } if ($work eq "search") { $searchswitch = "ON"; $searchcontent = $FORM{'search'}; &look; exit(0) } elsif ($work eq "add") { &addguest; exit(0); } elsif ($work eq "look") { &look; exit(0); } elsif ($work eq "manage") { &manage; exit(0); } elsif ($work eq "del") { &del; exit(0); } elsif ($work eq "guestbook") { &guestbook; exit(0); } &look; exit(0); sub look { dbmopen(%TEMP,"$datapath$user",0666); %USERLIST = %TEMP; dbmclose(%TEMP); @userno=keys %USERLIST; @userno=sort @userno; $totalrecode = $#userno+1; print <$title

HTMLEOF if ($searchswitch ne "ON") { $temp = $totalrecode-($page)*$pagenum; } else { $temp = 0; $searchtotal = 0; foreach (%USERLIST) { if ($_ =~ /$searchcontent/) { $searchtotal++; } } } print < \n"; if ($deleteyes eq "del") { print <記錄: HTMLEOF } print <

姓名:

HTMLEOF if ($deleteyes eq "del") { print < EOF } print <
HTMLEOF } sub manage { dbmopen(%TEMP,"$datapath$user",0666); %USERLIST = %TEMP; dbmclose(%TEMP); @userno=keys %USERLIST; @userno=sort @userno; $totalrecode = $#userno+1; $deleteyes = "del"; print <花斑豬留言板管理窗口

回上一頁



[版主管理] [給我留言] [給我寫信]

往下看吧!

  總記錄數: $totalrecode 個 HTMLEOF if ($searchswitch eq "ON") $searchcontent = $FORM{'search'}; &look; exit(0) } elsif ($work eq "add") { &addguest; exit(0); } elsif ($work eq "look") { &look; exit(0); } elsif ($work eq "manage") { &manage; exit(0); } elsif ($work eq "del") { &del; exit(0); } elsif ($work eq "guestbook") { &guestbook; exit(0); } &look; exit(0); sub look { dbmopen(%TEMP,"$datapath$user",0666); %USERLIST = %TEMP; dbmclose(%TEMP); @userno=keys %USERLIST; @userno=sort @userno; $totalrecode = $#userno+1; print <$title

HTMLEOF if ($searchswitch ne "ON") { $temp = $totalrecode-($page)*$pagenum; } else { $temp = 0; $searchtotal = 0; foreach (%USERLIST) { if ($_ =~ /$searchcontent/) { $searchtotal++; } } } print <


[版主管理] [給我留言] [給我寫信]

往下看吧!

  總記錄數: $totalrecode 個 HTMLEOF if ($searchswitch eq "ON") { printf (",找到 %d 個記錄",$searchtotal); } print <

HTMLEOF if ($temp < 0) {$temp = 0}; for ($inti = ($totalrecode-($page-1)*$pagenum-1);$inti >= $temp;$inti--) { $tmp=$userno[$inti]; ($mark,$name,$email,$place,$photo,$texti,$url,$ipaddress,$date_time,$markend,$last)=split(/∥/,$USERLIST{$tmp}); $recode = $inti+1; $photoimage = substr($photo,0,2); $photoname = substr($photo,4,4); $photoimage = "$photopath$photoimage.gif"; if ($searchswitch ne "ON") { &writeguest; } else { if ($USERLIST{$tmp} =~ /$searchcontent/) { &writeguest; } } } $tmp = $totalrecode / $pagenum; $temp= $totalrecode % $pagenum; if ($temp != 0) {$tmp++;} $pageindex = ""; for ($inti = 1;$inti <= $tmp; $inti++) { $pageindex = "$pageindex $inti"; } if (($totalrecode == 0) || ($searchtotal == 0)) { if ($searchswitch ne "ON") { if ($totalrecode == 0) { print "沒有記錄

\n"; } } else { print "沒有找到符合條件的記錄

\n"; } } print <
HTMLEOF if ($searchswitch ne "ON") { print <頁數:$pageindex HTMLEOF } else { print "退出查找"; } print <

   

[版主管理] [給我留言] [給我寫信]

花斑豬CGI工厂出品 1999 Made in China.

HTMLEOF } sub addguest { $name = &checknull($FORM{'name'} ,"名字項不能為空!!"); $email = $FORM{'email'}; $place = $FORM{'place'}; $url = $FORM{'url'}; $texti = &checknull($FORM{'texti'} ,"留言項不能為空!!"); $photo = $FORM{'photo'}; $newuserno = sprintf ("%04d%02d%02d%02d%02d%02d",$year,$mon,$mday,$hour,$min,$sec); $ipaddress = $ENV{'REMOTE_ADDR'}; $date_time = sprintf ("%04d/%02d/%02d %02d:%02d:%02d",$year,$mon,$mday,$hour,$min,$sec); dbmopen(%USERFILE,"$datapath$user",0666); $USERFILE{$newuserno} = "start∥$name∥$email∥$place∥$photo∥$texti∥$url∥$ipaddress∥$date_time∥end∥\n"; dbmclose(%USERFILE); $linkurl = "$cgi_url?work=look&user=$user&page=1"; print ""; } sub checknull { if ($_[0] eq "") { &errorinput($_[1]); } else { if ($allow_html ==0) { $return=&filterhtml($_[0]); } else { $return=$_[0]; } } return $return; } sub errorinput { print "

 

\n

$_[0]

\n
\n

回上一頁

\n\n\n"; exit; } sub filterhtml { local($return)=$_[0]; $return =~ s///g; if ($allow_html == 0) { $return =~ s/<([^>]|\n)*>//g; $return =~ s/\n"; print "
$tmp
$name 我是:$photoname $photoname 記錄號:NO.$recode

住址:

$place
電郵地址: $email 訪問時間:

$date_time

主頁地址: $url IP地址: $ipaddress
留言: $texti
版主回复: 你的操作: 刪除記錄
回复記錄

版主登陸

斑豬賬號:    
斑豬密碼:    
HTMLEOL $temp = $totalrecode-($page)*$pagenum; if ($temp < 0) {$temp = 0}; for ($inti = ($totalrecode-($page-1)*$pagenum-1);$inti >= $temp;$inti--) { $tmp=$userno[$inti]; ($mark,$name,$email,$place,$photo,$texti,$url,$ipaddress,$date_time,$markend,$last)=split(/∥/,$USERLIST{$tmp}); $recode = $inti+1; $photoimage = substr($photo,0,2); $photoname = substr($photo,4,4); $photoimage = "$photopath$photoimage.gif"; &writeguest; } $tmp = $totalrecode / $pagenum; $temp= $totalrecode % $pagenum; if ($temp != 0) {$tmp++;} $pageindex = ""; for ($inti = 1;$inti <= $tmp; $inti++) { $pageindex = "$pageindex $inti"; } if ($totalrecode==0) { print "


沒有記錄


\n"; } print <頁數:$pageindex

       


HTMLEOF } sub del { if (($FORM{'adminame'} eq $adminame) && ($FORM{'admipass'} eq $admipass)) { dbmopen(%USERLIST,"$datapath$user",0666); @userno=keys %USERLIST; @userno=sort @userno; $totalrecode = $#userno+1; print "

記錄:"; for ($inti = $totalrecode-1;$inti >= 0;$inti--) { $tempint=$inti+1; $tempnum = "recode$tempint"; $tempno=$FORM{$tempnum}; $tempjob = "job$tempint"; $tmpjob = $FORM{$tempjob}; $tempre = "re$tempint"; $tmpre = $FORM{$tempre}; if ($tempno ne "") { if ($tmpjob eq "del") { foreach (@userno) { if ($tempno eq $_) { print " No.$tempint"; delete $USERLIST{$tempno}; } } } else { print " No.$tempint"; ($mark,$name,$email,$place,$photo,$texti,$url,$ipaddress,$date_time,$markend,$last)=split(/∥/,$USERLIST{$tempno}); $texti="$texti

    版主回复:$tmpre
"; #
     版主回复: $tmpre"; $USERLIST{$tempno} = "start∥$name∥$email∥$place∥$photo∥$texti∥$url∥$ipaddress∥$date_time∥end∥\n"; } } } dbmclose(%USERLIST); print "

"; print "


刪除或回复留言成功!!!


"; print "

返回留言版

\n"; } else { print "


用戶名或密碼錯誤!!!


"; print "

回上一頁

\n"; } } sub guestbook { print <花斑豬留言板

給我留言

您的名字:

電子郵件地址:

您的地址:

主頁地址:
選擇自己的倩照:
倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照

男孩

女孩

成龍

老大

大嬸

杰克

煙鬼

喬治

和尚

關公

倒霉

呆頭

大傻

美女

超人

小妹
倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照 倩照

帥男

美眉

耶穌

教授

民工

羅茜

熊貓

小貓

豬豬

螵虫

青蛙

駱駝

企鵝

悲傷

高興

鬼臉
您要說什么?

 

    
GUESTEOF }