#!/usr/bin/perl ########## - Ver 3.5 - [InterGB] -------- ##################################################### # # Created by Paul Williams # E-Mail: paul@rainbow.nwnet.co.uk # http://scripts.marschall.net/ # Created: 5 July 1996 # Last Updated: 18 Feb 1998 # ########## - ? Copyright 1998 Cougasoft - ##################################################### # # About: The redistribution or reselling of this code is strictly # prohibited, I don't mind if you alter the code but please # give credit where credit is due ;) # # Basically, all I ask is you don't try and make a profit from # this script. If you are in the webhosting business, please # visit my website for a serverpack. # # Source [IS NOT] to be redistributed in any form of medium. # ########## ------------------------------ ##################################################### # $admin = 'igb-admin.cgi'; # ########## ------------------------------ ##################################################### # # M A I N P R O G R A M # ########## ------------------------------ ##################################################### # unless (do "data/igb-pref.pref" || do "igb-pref.pref") { print "Content-type: text/plain\n\n" . "_________________________________________________________\n\n" . "- 找不到 [igb-pref.pref] 档案 ! -\n" . "- 你必须上传这个档案, -\n" . "- 并确定你的档案路径是正确的 -\t\t\t\t-\n\n" . "_________________________________________________________\n\n"; exit(0); } # ########## ------------------------------ ##################################################### # ########## - READ_STDIN [] -------------- ##################################################### # read(STDIN, $input, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $input); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ tr/;/:/; $value =~ s/<([^>]|\n)*>//g if ($html); $INPUT{$name} = $value; } # ########## ------------------------------ ##################################################### # ########## - ACTION:SIGN_BOOK [] -------- ##################################################### # if ($ENV{'QUERY_STRING'} eq "action=sign-guestbook") { &top_html("Sign in...", 1); print "
以下凡是有 * 记号者,一定要填写

\n" . "

\n" . "\n" . "\n" . "\n\n" . "\n" . "\n\n" . "\n" . "\n\n" . "\n" . "\n\n" . "\n" . "\n\n" . "\n" . "\n\n" . "\n" . "\n\n" . "\n" . "\n\n" . "\n" . "\n\n" . "\n" . "\n\n" . "\n" . "\n\n" . "\n" . "\n\n" . "\n" . "\n\n"; print "
访客姓名*
Email
访客性别*男\n" . "
现在心情*
ICQ UIN
居住城市
居住省州
居住国家
首页网址
首页名称
留言内容*
留言加密[如果选择加密,本篇留言将直接送到板主信箱,不会出现在留言簿上]
 
\n"; &bottom(1); } # ########## ------------------------------ ##################################################### # ########## - ACTION:REDIRECT [] --------- ##################################################### # elsif ($ENV{'QUERY_STRING'} eq "action=random-link") { open(DATA, "$data") || ¬ify("501 Data Server Error", "找不到 \$data 档
请上传以後再尝试.", 0); @data = ; close(DATA); srand(time ^ $$); print "Content-type: text/html\n"; for ($n = 0;$n < 3; $n++) { $l = $data[rand($#data)]; ($email, $name, $sex, $pic, $icq, $city, $state, $comment, $link, $web, $date, $country) = split('\|\|', $l); if ($link =~ m`^http://`) { print "Location: $link\n\n"; exit(0); } print "Location: http://scripts.marschall.net/\n\n" if ($n == 2); } } # ########## ------------------------------ ##################################################### # ########## - ACTION:SIGN_BOOK [] -------- ##################################################### # elsif ($ENV{'QUERY_STRING'} eq "action=signed-guestbook") { ¬ify("500 Internal Server Error", "[BAD HTTP_REFERER !]", 2) if ($ENV{'HTTP_REFERER'} !~ /^http:\/\/$ENV{'HTTP_HOST'}$ENV{'SCRIPT_NAME'}/); &missing("FIRST NAME") unless $INPUT{'FIRST-NAME'}; &missing("COMMENTS") unless $INPUT{'comments'}; if ($INPUT{'LINK'}) { ¬ify("501 Data Server Error", "有问题的网址.", 1) if ($INPUT{'LINK'} !~ /^http:\/\/[\w\W]+\.[\w\W]+$/); } $comments = $INPUT{'comments'}; $INPUT{'comments'} =~s/\cM\n/
/g; $INPUT{'EMAIL'} =~ tr/A-Z/a-z/; #以下为脏话过滤功能 $INPUT{'comments'} =~ s/fuck|twat\b|dick|bellend\b|poes\b|chood\b|coochka\b |mrdat\b|prcat\b|hai\b|chao\b|kurat\b|vitt\b|vittu\b|encule\b|foutre\b |fick\b|pule\b|cunt\b|fitte\b|pikk\b|coor-va\b|foda-se\b|bastard\b |bollocks\b|clit\b|faggot\b|gangbang\b|tosser\b|wanker\b|tosspot\b |shit\b|whore\b|pillock\b|frigging\b|shite\b/[BAD]/gi; &write(); &sendmail(); print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "\n"; print " $gb_name - Success!!\n"; print "\n"; print "\n"; print "\n\n"; print "

\n\n" if ($my_link); print "

\n\n" if (!$my_link); print "
[签写留言] - [回到首页] - "; print "[随意连结] - [管理页面]
\n" if ($_[1] != 1); print "
\n"; print "
本留言板最大容量为 $mlog 篇留言
\n"; print "留言板不支援HTML语法,断行请按ENTER键
\n\n" if($html); print "留言板支援HTML语法,断行请按ENTER键
\n\n" if(!$html); print "

\n\n"; print "
\n\n"; print "\n\n" if ($INPUT{'FIRST-NAME'}); print "\n" if ($INPUT{'EMAIL'} !~ /--/); print "\n"; print "\n" ; print "\n" if ($INPUT{'icq'} !~ /--/); print "\n\n" if ($INPUT{'CITY'} !~ /--/); print "\n\n" if ($INPUT{'STATE'} !~ /--/); print "\n\n" if ($INPUT{'COUNTRY'} !~ /--/); print "\n\n" if ($INPUT{'LINK'} !~ /--/); print "\n\n" if ($INPUT{'web'} !~ /--/); print "\n\n" if ($INPUT{'comments'}); print "\n\n" if ($INPUT{'nopost'}); print "\n" if (!$INPUT{'nopost'}); print "\n" if ($INPUT{'nopost'}); print "
访客姓名$INPUT{'FIRST-NAME'}
Email\n$INPUT{'EMAIL'}
访客性别\n$INPUT{'sex'}
现在心情\n$INPUT{'pic'}
ICQ UIN\n$INPUT{'icq'}
居住城市$INPUT{'CITY'}
居住省州$INPUT{'STATE'}
居住国家$INPUT{'COUNTRY'}
首页网址$INPUT{'LINK'}
首页网址$INPUT{'web'}
留言内容$INPUT{'comments'}
加密 ?这篇将直接送到板主信箱,不会出现在留言簿

谢谢您来填写留言! 观看留言
3秒後转送至留言板" . "

谢谢您的意见! 回首页
3秒後转送至留言板" . "
\n"; &bottom(0); } # ########## ------------------------------ ##################################################### # ########## - ACTION:MAIN [] ------------ ##################################################### # else { if (!-e "$data" || !-e "$mailpgrm") { $dataprf = "Guestbook Data File" if (!-e "$data"); $mailprf = "Mail Program [Sendmail]" if (!-e "$mailpgrm"); &top_html("500 Internal Server Error", 1); print "
\n" . "\n" . "\n"; print "\n
\n" . "
状态 -
$dataprf
\n" . "
$mailprf
找不到.
\n" . "
请至 管理区域.
\n" . "
\n\n"; &bottom(1); } open(DISPLAY, "$data") || ¬ify("500 Internal Server Error", "找不到 \$data 档
请上传以後再尝试.", 0); if ($display == 2) { @lines = reverse(); } else { @lines = ; } close(DISPLAY); &top_html("Welcome !"); print "
\n"; foreach (@lines) { ($email, $name, $sex, $pic, $icq, $city, $state, $comment, $link, $web, $date, $country) = split('\|\|'); print "\n\n\n\n"; print "\n\n\n\n"; } print "\n\n\n\n"; print "
 "; print "
"; if("$email" eq "--") { print "$name - $date
\n"; } else { print "$name - $date
\n"; } print "
\n"; print "首页$web
\n" unless $link eq "--"; print "$icq" unless $icq eq "--"; print "

"; print "$comment \n\n"; print "

"; print "($country)" unless $country eq "--"; print "- $state " unless $state eq "--"; print "- $city " unless $city eq "--"; print "

" unless $state eq "--" && $city eq "--"; print "
 "; print "
\n"; print "


Script written by Paul Williams " . "CougaSoft
人物表情图提供小正正的家 - 程式修改衣剑舞 整理Oh Yeah Net

"; &bottom(1); } # ########## ---------------------- ############################################################# # # S U B R O U T I N E S # ########## - ADDITIONAL STUFF [] ############################################################# # sub top_html { print "Content-type: text/html\n\n" . "\n" . "\n" . "\n" . " $gb_name - $_[0]\n" . "\n". "\n" . "\n\n"; print "

\n\n" if ($my_link); print "

\n\n" if (!$my_link); print "
[签写留言] - [回到首页] - " . "[随意连结] - [管理页面]
\n" if ($_[1] != 1); print "
\n"; print "
本留言板最大容量为 $mlog 篇留言
\n"; print "留言板不支援HTML语法,断行请按ENTER键
\n\n" if($html); print "留言板支援HTML语法,断行请按ENTER键
\n\n" if(!$html); print "

\n\n"; } # ########## ---------------------- ############################################################# # # S U B W R I T E - B O O K # ########## - WRITE_BOOK [] ------ ############################################################# # sub write { $INPUT{'EMAIL'} = "--" unless $INPUT{'EMAIL'}; $INPUT{'CITY'} = "--" unless $INPUT{'CITY'}; $INPUT{'STATE'} = "--" unless $INPUT{'STATE'}; $INPUT{'COUNTRY'} = "--" unless $INPUT{'COUNTRY'}; $INPUT{'LINK'} = "--" unless $INPUT{'LINK'}; $INPUT{'web'} = "--" unless $INPUT{'web'}; $INPUT{'icq'} = "--" unless $INPUT{'icq'}; open(FILE, "$data") || ¬ify("500 Internal Server Error", "找不到 \$data 档
请上传以後再尝试.", 0); while () { ($email, $name, $sex, $pic, $icq, $city, $state, $comment, $link, $web, $date, $country) = split('\|\|'); ¬ify("500 Internal Server Error", "重复填写留言,这篇留言已经出现过了.
" . "请回留言板 .", 0) if ($comment eq $INPUT{'comments'}); } close(FILE); if (!$INPUT{'nopost'}) { &date(); $init = (0); $mlog = $mlog - 1; open(LINK, "$data"); @link = ; close(LINK); open(FILE, ">$data") || ¬ify("500 Internal Server Error", "无法写入 \$data 档案
chmod 666 以後再尝试.", 0); print FILE "$INPUT{'EMAIL'}||$INPUT{'FIRST-NAME'}||$INPUT{'sex'}||$INPUT{'pic'}||$INPUT{'icq'}||$INPUT{'CITY'}||" . "$INPUT{'STATE'}||$INPUT{'comments'}||$INPUT{'LINK'}||$INPUT{'web'}||$date||$INPUT{'COUNTRY'}||\n"; while ($init !=$mlog) { print FILE "$link[$init]"; $init++; } close(FILE); } } # ########## ---------------------- ############################################################# # # S U B S E N D M A I L # ########## - SENDMAIL [] -------- ############################################################# sub sendmail { if ($email_you) { if ($INPUT{'EMAIL'} =~ /.*\@.*\..*/){ $MAIL =~ s/%n/$INPUT{'FIRST-NAME'}/g; $MAIL =~ s/%e/$INPUT{'EMAIL'}/g; $MAIL =~ s/%u/$INPUT{'LINK'}/g; $MAIL =~ s/%c/$INPUT{'comments'}/g; $MAIL =~ s/%g/http:\/\/$ENV{'SERVER_NAME'}$ENV{'SCRIPT_NAME'}/g; $MAIL =~ s/\\n/\n/g; open(MAIL, "| $mailpgrm -t") || ¬ify("500 Internal Server Error", "找不到送信路径
请检查您的送信路径是否正确.", 0); print MAIL "To: $INPUT{'FIRST-NAME'} <$INPUT{'EMAIL'}>\n"; print MAIL "From: $yourname <$youremail>\n"; print MAIL "Subject: $subject\n"; print MAIL "\n"; print MAIL "$MAIL\n\n"; close(MAIL); } } &date(); if ($INPUT{'nopost'}) { open(MAIL, "| $mailpgrm -t") || ¬ify("500 Internal Server Error", "找不到送信路径
请检查您的送信路径是否正确.", 0); print MAIL "To: $yourname <$youremail>\n"; print MAIL "From: $INPUT{'EMAIL'}\n"; print MAIL "Subject: 保密留言 [$date]\n"; print MAIL "\n"; print MAIL "保密内容:-\n"; print MAIL "\n"; print MAIL "访客 : $INPUT{'FIRST-NAME'}\n"; print MAIL "E-mail : $INPUT{'EMAIL'}\n"; print MAIL "内容 :\n"; print MAIL " $comments\n\n\n"; print MAIL "---------------------------------------->>-\n"; close(MAIL); } if ($notify) { if ($INPUT{'nopost'} != '1') { open(MAIL, "| $mailpgrm -t") || ¬ify("500 Internal Server Error", "找不到送信路径
请检查您的送信路径是否正确.", 0); print MAIL "To: $yourname <$youremail>\n"; print MAIL "From: $INPUT{'EMAIL'}\n"; print MAIL "Subject: 新的留言 [$date]\n"; print MAIL "\n"; print MAIL "留言内容:-\n"; print MAIL "\n"; print MAIL "访客 : $INPUT{'FIRST-NAME'}\n"; print MAIL "E-mail : $INPUT{'EMAIL'}\n"; print MAIL "内容 :\n"; print MAIL " $comments\n\n\n"; print MAIL "---------------------------------------->>-\n"; close(MAIL); } } } ########## ---------------------- ############################################################# # ########## ---------------------- ############################################################# # # S U B D A T E # ########## - DATE [] ------------ ############################################################# # sub date { @days = ('Sun','Mon','Tues','Wed','Thur','Fri','Sat'); @months = ('01/','02/','03/','04/','05/','06/','07/', '08/','09/','10/','11/','12/'); ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = localtime(time+(3600*($addtime))); $hour = "0$hour" if ($hour < 10); $min = "0$min" if ($min < 10); $sec = "0$sec" if ($sec < 10); $date = "$year/$months[$mon]$mday - $hour:$min"; $date; } # ########## ---------------------- ############################################################# # # S U B S T A T U S # ########## - STATUS [] ---------- ############################################################# # sub status { if (!-e "$link_file") { &top_html("Problema !", 0); print "
" . "" . ""; print "
" . "
状态 -
连结数据档案
" . "
找不到.
请到 管理区域.
\n" . "
\n\n"; &bottom(1); } } # ########## ---------------------- ############################################################# # # S U B N F R A M E # ########## - NFRAME [] ---------- ############################################################# # sub nframe { print "
\n" . " \n\n \n"; print "
\n" . " $_[0]
\n\n"; } # ########## ---------------------- ############################################################# # # S U B M I S S I N G # ########## - MISSING [] --------- ############################################################# # sub missing { &top_html("Missing Field", 1); &nframe ("Missing Field [$_[0]]
Return to the " . " F O R M and try again."); &bottom(1); } # ########## ---------------------- ############################################################# # # S U B N O T I F Y # ########## - NOTIFY [] ---------- ############################################################# # sub notify { $xtra = "
请回到 表单再试一次." if ($_[2] ==1); $xtra = "
请回到 首页." if ($_[2] == 2); &top_html("$_[0]", 1); &nframe ("$_[1] $xtra"); &bottom(1); } # ########## ---------------------- ############################################################# # # S U B B O T T O M # ########## - BOTTOM [] ---------- ############################################################# # sub bottom { print "\n"; print "\n"; exit(0) if ($_[0]); } # ########## ---------------------- ############################################################# # ########## - EXIT(0) ------------ ############################################################# #