www.pudn.com > bbs3000afree.zip > mail.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 <
您的E-Mail
加入 | 退出

管理专区 请输入管理密码 
 

EOF &Bottom; exit; } sub subscribe { unless ($INPUT{'address'}=~/\@/) { print "您的E-Mail输入有问题,请回 上一页 重新输入
"; &Bottom; exit; } open(LIST,"$listfile"); @addresses=; close(LIST); @add = grep{ /$INPUT{'address'}/i } @addresses; if (@add) { print < 这个E-Mail已经输入过了 ,确定已经在我们的邮件列表中 EOF &Bottom; exit; } open(LIST,">>$listfile") || &error("无法写入$listfile"); print LIST "$INPUT{'address'}\n"; close(LIST); print < 谢谢您的加入

您的信箱 $INPUT{'address'} 已经加入到我们的列表中 EOF &Bottom; exit; } sub remove{ unless ($INPUT{'address'}) { print < 您没有输入信箱位址 EOF &Bottom; exit; } open(LIST,"$listfile"); @addresses=; close(LIST); @add = grep{ !(/$INPUT{'address'}/i) } @addresses; open(LIST,">$listfile") || &error("无法写入$listfile"); print LIST @add; close(LIST); print < 很遗憾您的退出

您的信箱 $INPUT{'address'} 已经从我们的列表中删除
EOF &Bottom; exit; } sub email { &checkpassword; print "Content-type: text/html \n\n"; &Top; print < 邮件已经寄出 EOF &Bottom; open(LIST,"$listfile"); @addresses=; 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'}

服务提供:$zyname 程序制作:Yuzi工作室
--------------------------------------------------
如果您不想再收到我们的讯息,请按下列网址直接删除
$ym/mail.cgi?$line\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共发出 $num_email 封邮件,送出了以下讯息
--------------------------------------------------
$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=; close(LIST); @addresses = sort(@addresses); print < function clean(){ if (confirm("该项操作将会清除现在邮件列表中所有的EMAIL,您确定要继续进行吗?")){ return true; } return false; } 选择要删除的信箱

EOF $num_email=0; foreach $line(@addresses) { chomp($line); if ($num_email == 3) { print ""; $num_email=0; } print ""; $num_email++; } print <
$line

输入您的管理密码

EOF &Bottom; exit; } sub delete_final { &checkpassword; open(LIST,"$listfile"); @addresses=; 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 < 已经删除

$INPUT{'delete'} EOF &Bottom; exit; } sub sendemail { &checkpassword; print <
主题 
信件内容 HTML格式


EOF &Bottom; exit; } sub checkpassword { if ($INPUT{'password'}) { unless ($delpsd eq $INPUT{'password'}) { print <错误的密码 EOF &Bottom; exit; }} else { print <您必须输入密码 EOF &Bottom; exit; }} sub Top { print <BBS3000邮件列表


EOF } sub Bottom { print <[ BACK ]

Powered by www.yuzi.net ©1998-2001
Yuzi Bulletin Board Version 3000
EOF } sub error{ $errors = $_[0] ; print <错误发生

错误: $errors

$! EOF &Bottom; exit; } sub add { &checkpassword; opendir (MEMBERDIR2, "$filepath/yhzl"); @members2 = readdir(MEMBERDIR2); closedir (MEMBERDIR2); foreach $m (@members2){ open(PSD,"$filepath/yhzl/$m"); $line=; 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 < 您已经成功地将社区内 $totle 位用户的EMAIL全部导入到邮件列表中了,请稍候,系统将自动返回......

如果系统没有反应,请点击这里返回! EOF } ######################### END OF SCRIPT #########################