⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mail.cgi

📁 --黑客防线-精华奉献本(攻册)
💻 CGI
字号:
#!/usr/bin/perl
#------------------------------------------------------#
#         本程序为Yuzi工作室提供        #
#        Yuzi论坛3000(BBS3000)v4.00      #
#------------------------------------------------------#
$cgipa=".";  # CGI程序文件的绝对路径
######################
## 以下部分不需修改 ##
######################
require "$cgipa/setup.cgi";
$listfile="$filepath/data/maillist.cgi";
$thisurl = $ENV{'SCRIPT_NAME'};
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 ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; }
else { $INPUT{$name} = $value; }}
unless ($INPUT{'email'}) {
print "Content-type: text/html;CHARSET=gb2312 \n\n";
&Top;
}
$temp=0;
$temp=$ENV{'QUERY_STRING'};
if ($temp) {
$INPUT{'address'} = $temp;
&remove;
}
if ($INPUT{'email'}) { &email; }
elsif ($INPUT{'action'} eq "subscribe") { &subscribe; }
elsif ($INPUT{'action'} eq "remove") { &remove; }
elsif ($INPUT{'newpass'}) { &newpass; }
elsif ($INPUT{'add'}) { &add; }
elsif ($INPUT{'delete_select'}) { &delete_select; }
elsif ($INPUT{'delete_final'}) { &delete_final; }
elsif ($INPUT{'sendemail'}) { &sendemail; }
else { &admin; }
exit;
sub admin {
print <<EOF;
<TABLE bordercolor=ffffff cellSpacing=1 cellPadding=8 width=490 bgColor=00416b><TBODY><tr bgColor=e4e4e4><TD bgColor=e4e4e4 height=22><CENTER><form action="$thisurl" method=post><SPAN>您的E-Mail</SPAN> <INPUT size=30 name=address> <BR><INPUT type=radio CHECKED value=subscribe name=action> <FONT size=-1>加入 | 退出</FONT> <INPUT type=radio value=remove name=action> <BR><INPUT type=submit value=确定></CENTER></TD></TR> </TBODY></FORM></TABLE><IMG src="$imagurl/mail3000.gif"><BR>
<TABLE cellSpacing=1 cellPadding=5 width=316 bgColor=00416b border=0><TBODY><TABLE cellSpacing=1 cellPadding=5 width=316 bgColor=00416b border=0><form action="$thisurl" method=post><TBODY>
<TR align=middle bgColor=e4e4e4><TD bgColor=e4e4e4 width="95"><SPAN><font face="隶书" size="4"><b>管理专区</b></font> </SPAN></TD>
<TD bgColor=e4e4e4 width="191">请输入管理密码 <INPUT
type=password name=password size="10"></TD></TR><TR align=middle bgColor=e4e4e4><TD bgColor=e4e4e4 height=2 colspan="2" width="300"> <SPAN><INPUT type=submit value='发送信件'name=sendemail> <INPUT type=submit value='删除用户' name=delete_select>
</SPAN> </TD></TR></TBODY></TABLE><BR>
EOF
&Bottom;
exit;
}
sub subscribe {
unless ($INPUT{'address'}=~/\@/)   {
print "<font color=FFFFFF>您的E-Mail输入有问题,请回 <a href=javascript:history.back()><font color=FFFFFF>上一页</a> 重新输入</font><br>";
&Bottom;
exit;
}
open(LIST,"$listfile");
@addresses=<LIST>;
close(LIST);
@add = grep{ /$INPUT{'address'}/i } @addresses;
if (@add) {
print <<EOF;
<table cellspacing =1 bgcolor =#00416B border=0 cellpadding =8><TR bgColor=E4E4E4 align=center><TD>
这个E-Mail已经输入过了 ,确定已经在我们的邮件列表中
</td></TR></TABLE>
EOF
&Bottom;
exit;
}
open(LIST,">>$listfile") || &error("无法写入$listfile");
print LIST "$INPUT{'address'}\n";
close(LIST);
print <<EOF;
<table cellspacing =1 bgcolor =#00416B border=0 cellpadding =8 width=400><TR bgColor=E4E4E4 align=center><TD><FONT SIZE=-1>
谢谢您的加入<BR><BR>您的信箱 <font color=red>$INPUT{'address'}</font> 已经加入到我们的列表中</td></tr></table>
EOF
&Bottom;
exit;
}
sub remove{
unless ($INPUT{'address'}) {
print <<EOF;
<table cellspacing =1 bgcolor =#E4E4E4 border=0 cellpadding =8><TR align=center><TD><FONT SIZE="-1">
您没有输入信箱位址</font></td></TR></TABLE>
EOF
&Bottom;
exit;
}
open(LIST,"$listfile");
@addresses=<LIST>;
close(LIST);
@add = grep{ !(/$INPUT{'address'}/i) } @addresses;
open(LIST,">$listfile") || &error("无法写入$listfile");
print LIST @add;
close(LIST);
print <<EOF;
<table cellspacing =1 bgcolor =#00416B border=0 cellpadding =8><TR bgColor=E4E4E4 align=center><TD><FONT SIZE="-1">
很遗憾您的退出<BR><BR>您的信箱 <font color=red>$INPUT{'address'}</font> 已经从我们的列表中删除
</font></td></TR></TABLE>
EOF
&Bottom;
exit;
}
sub email {
&checkpassword;
print "Content-type: text/html \n\n";
&Top;
print <<EOF;
<table cellspacing =1 bgcolor =#00416B border=0 cellpadding =8><TR bgColor=E4E4E4 align=center><TD><FONT SIZE="-1">
邮件已经寄出
</font></td></TR></TABLE>
EOF
&Bottom;
open(LIST,"$listfile");
@addresses=<LIST>;
close(LIST);
$num_email=0;
foreach $line(@addresses) {
chomp($line);
$sendto="$line";
$subject="$INPUT{'subject'}";
if ($INPUT{'zchtml'} eq "1") {
$message="Content-Type: text/html;charset=gb2312\n\n$INPUT{'body'}<br><br>服务提供:<a href=$zyurl>$zyname</a> 程序制作:<a href=http://www.yuzi.net target=_blank>Yuzi工作室</a><BR>--------------------------------------------------<BR>如果您不想再收到我们的讯息,请按下列网址直接删除<BR><a href=$ym/mail.cgi?$line>$ym/mail.cgi?$line</a>\n";
}else{
$message="\n$INPUT{'body'}\n\n服务提供:$zyname($zyurl) 程序制作:Yuzi工作室(http://www.yuzi.net)\n-----------------------------------------------------------------\n如果您不想再收到我们的讯息\n请按下列网址直接删除 \n$ym/mail.cgi?$line\n\n\n";
}
if(-e $mailprg){&sendmail;}else{do "$cgipa/sub/smtp.cgi";}
$num_email++;
}
$sendto="$adminmail";
$subject="$INPUT{'subject'}";
if ($INPUT{'zchtml'} eq "1") {
$message="Content-Type: text/html;charset=gb2312\n\n共发出 <font color=FF0000>$num_email</font> 封邮件,送出了以下讯息<BR>--------------------------------------------------<BR>$INPUT{'body'}";
}else{
$message="\n共发出 $num_email 封邮件,送出了以下讯息\n\n--------------------------------------------------\n$INPUT{'body'}";
}
if(-e $mailprg){&sendmail;}else{do "$cgipa/sub/smtp.cgi";}
exit;
}
sub delete_select {
&checkpassword;
open(LIST,"$listfile");
@addresses=<LIST>;
close(LIST);
@addresses = sort(@addresses);
print <<EOF;
<SCRIPT>
function clean(){
if (confirm("该项操作将会清除现在邮件列表中所有的EMAIL,您确定要继续进行吗?")){
return true;
}
return false;
}
</SCRIPT><B><font color=FFFFFF>选择要删除的信箱</font></B><br><br><FORM METHOD=POST ACTION="$thisurl"><INPUT type="hidden" NAME=password VALUE=$INPUT{'password'}><INPUT TYPE="SUBMIT" NAME="add" VALUE="点击此将社区内所有的用户Email导入到邮件列表" onclick="return clean()"></form>
<table cellspacing =1 bgcolor =#00416B border=0 cellpadding =3><TR bgColor=E4E4E4 align=left>
<FORM METHOD=POST ACTION="$thisurl">
EOF
$num_email=0;
foreach $line(@addresses) {
chomp($line);
if ($num_email == 3) {
print "</TR><TR bgcolor=\#E4E4E4 align=left>";
$num_email=0;
}
print "<TD><FONT SIZE=-1><INPUT TYPE=CHECKBOX NAME=delete VALUE=$line>$line</TD>";
$num_email++;
}
print <<EOF;
</TD></TR></TABLE><BR><table cellspacing =1 bgcolor =#00416B border=0 cellpadding =8>
<TR bgColor=E4E4E4 align=center><TD><FONT SIZE=-1>
输入您的管理密码<BR><input type=password name="password"><BR><INPUT TYPE="SUBMIT" NAME="delete_final" VALUE="删除信箱">
</TD></TR></TABLE></form>
EOF
&Bottom;
exit;
}
sub delete_final {
&checkpassword;
open(LIST,"$listfile");
@addresses=<LIST>;
close(LIST);
@deleting = split(/\,/,$INPUT{'delete'});
foreach $line(@deleting) {
@addresses = grep{ !(/$line/i) } @addresses;
}
open(LIST,">$listfile") || &error("无法写入 $listfile");
print LIST @addresses;
close(LIST);
print <<EOF;
<table cellspacing =1 bgcolor =#00416B border=0 cellpadding =8 width=400><TR bgColor=E4E4E4 align=center>
<TD><FONT SIZE=-1>已经删除</font><BR><BR><FONT SIZE=-1 color=red>
$INPUT{'delete'}
</TD></TR></TABLE>
EOF
&Bottom;
exit;
}
sub sendemail {
&checkpassword;
print <<EOF;
<table cellspacing =1 bgcolor =#00416B border=0 cellpadding =8 width=400><TR bgColor=E4E4E4>
<TD><FORM METHOD=POST ACTION=$thisurl>
主题 <input type = text name=subject size=45><table border="0" width="95%"><tr><td width="50%">信件内容</td>
<td width="50%" align="right"><input type="checkbox" name="zchtml" value="1">HTML格式</td>
</tr></table><TEXTAREA NAME=body ROWS=14 COLS=50></TEXTAREA><BR><BR><INPUT type="hidden" NAME=password VALUE=$INPUT{'password'}><center><INPUT TYPE=SUBMIT NAME=email VALUE="发送邮件">
</TD></TR></FORM></TABLE>
EOF
&Bottom;
exit;
}
sub checkpassword {
if ($INPUT{'password'}) {
unless ($delpsd eq $INPUT{'password'}) {
print <<EOF;
<table cellspacing =1 bgcolor =#00416B border=0 cellpadding =8><TR bgColor=E4E4E4 align=center><TD>错误的密码
</TD></TR></TABLE>
EOF
&Bottom;
exit;
}}
else {
print <<EOF;
<table cellspacing =1 bgcolor =#00416B border=0 cellpadding =8><TR bgColor=E4E4E4 align=center><TD>您必须输入密码
</TD></TR></TABLE>
EOF
&Bottom;
exit;
}}
sub Top {
print <<EOF;
<HTML><HEAD><TITLE>BBS3000邮件列表</TITLE><META http-equiv=Content-Type content="text/html; charset=gb2312"><style>
a:visited {  text-decoration: none}
td {font-size: 9pt}
body {font-size: 9pt}
</style></HEAD><BODY text=#000000 bgColor=4f6984 leftMargin=0 background=$imagurl/mailbg.gif
topMargin=0><DIV align=center><IMG height=82 src="$imagurl/mailtiele.gif"
width=663><BR><BR></DIV><CENTER>
EOF
}
sub Bottom {
print <<EOF;
<BR><font color="#ffffff">[ <a href="javascript:history.back()"><font color="#ffffff">BACK</font></a> ]
<BR><HR width="80%" color=e4e4e4 noShade SIZE=1><SPAN><FONT color=e0e4e0>Powered by www.yuzi.net &copy;1998-2001<BR>Yuzi Bulletin Board Version 3000</FONT> </SPAN></CENTER></BODY></HTML>
EOF
}
sub error{
$errors = $_[0] ;
print <<EOF;
<table cellspacing =1 bgcolor =#00416B border=0 cellpadding =8><TR bgColor=E4E4E4 align=center><TD><B>错误发生</B><BR><BR>
错误: <font color=red>$errors</font><br><br><font color=red>$!</FONT></TD></TR></TABLE>
EOF
&Bottom;
exit;
}
sub add {
&checkpassword;
opendir (MEMBERDIR2, "$filepath/yhzl");
@members2 = readdir(MEMBERDIR2);
closedir (MEMBERDIR2);
foreach $m (@members2){
open(PSD,"$filepath/yhzl/$m");
$line=<PSD>;
close(PSD);
($rpassword,$rname,$mail)=split(/\t/,$line);
if($mail ne ""){
$all="$mail\n$all";
$totle++;
}}
open(LIST,">$listfile");
print LIST "$all";
close(LIST);
print <<EOF;
<HTML><head><META HTTP-EQUIV=Content-Type CONTENT=text/html; charset=gb2312><meta HTTP-EQUIV="REFRESH" CONTENT="10;URL=mail.cgi">
<LINK href="$imagurl/bbs.css" rel=stylesheet></head><font color=FFFFFF>您已经成功地将社区内 <font color=FF0000>$totle</font> 位用户的EMAIL全部导入到邮件列表中了,请稍候,系统将自动返回......
<BR><BR><A HREF="mail.cgi">如果系统没有反应,请点击这里返回!</A></html>
EOF
}
######################### END OF SCRIPT #########################

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -