📄 ad.pl
字号:
#!/usr/bin/perl
if ($ENV{'SCRIPT_FILENAME'}){
$home_dir=substr($ENV{'SCRIPT_FILENAME'},0,rindex($ENV{'SCRIPT_FILENAME'},"/"));
}else{
$home_dir=substr($ENV{'PATH_TRANSLATED'},0,rindex($ENV{'PATH_TRANSLATED'},"\\"));
$home_dir=~ s/\\/\//g;
}
$fullurl= "http://$ENV{'SERVER_NAME'}$ENV{'SCRIPT_NAME'}";
$cgiurl=substr($fullurl,0,rindex($fullurl,"/"));
$|=0;
########## 取得输入 ###########
do "$home_dir/ad_read_in.pl";
do "$home_dir/ad_del_nouse_user.pl";
do "$home_dir/ad_header.pl";
do "$home_dir/ad_heardboutton.pl";
do "$home_dir/ad_Tailer.pl";
&read_in;
require "$home_dir/$id/config.cfg";
require "$home_dir/$id/color.cfg";
require "$home_dir/$id/level.cfg";
require "$home_dir/$id/allow.cfg";
if (($username) && (-e "$homedir/userdb/$username")){
open(paSS,"$homedir/userdb/$username") || &error("无法打开文件\"userdb/$username\"");
@pass = <paSS>;
close(paSS);
@userlevel = split(/__/, $pass[0]);
}
$userinfo ="&username=$username&password=$password&userlevel=@userlevel[0]&id=$id";
$userinfo=~s/\n//g;
&del_nouse_user;
###########################################
if($in=~"search"){
do "$home_dir/ad_search.pl";
&header;
&heardboutton;
&search;
&tailer;
}
elsif($in=~"join"){
do "$home_dir/ad_input.pl";
$refresh = 1;
&header;
&heardboutton;
&input;
&tailer;
}
elsif($in=~"changpass"){
&header;
&heardboutton;
&changpass;
}
elsif($in=~"changall"){
do "$home_dir/ad_changall.pl";
$refresh = 1;
&header;
&changall;
&tailer;
}
elsif($in=~"admin") {
if ($chk eq "查找"){
do "$home_dir/ad_admin_html.pl";
&header;
&heardboutton;
&admin_html;
&tailer;
}else {
do "$home_dir/ad_admin.pl";
&header;
&admin;
&tailer;
}
}
elsif($in=~"mdf"){
do "$home_dir/ad_mdf.pl";
$refresh = 0;
&header;
&heardboutton;
&mdf;
&tailer;
}else {
do "$home_dir/ad_start.pl";
&header;
&heardboutton;
&start;
&tailer;
}
exit;
########################## 修改密码,接受完全修改请求以及管理员身份验证 #################
sub changpass {
if (($username eq "") || ($password eq "")){
&error("ERROR: No name & password","你没有输入姓名、密码或输入的姓名、密码格式不对!","2"); #没有姓名和密码
}else {
if (!(-e "$homedir/userdb/$username")) { &error("ERROR: NO THIS USER","你还没有注册呢!","2"); }
open(paSS,"$homedir/userdb/$username") || &error("ERROR: DON'T OPEN","无法打开文件\"$username\"","2");
@pass = <paSS>;
close(paSS);
($chkuserlevel,$chkuserpassword,$chkwelcom,$chkuserid,$chkuseremail,$chkurl,$chkgeyan,$chkpotourl,$chkuserip,$chkmdfip,$chktime,$chknow_sec,$chklasttime,$chkjingyan) = split(/__/, $pass[0]);
if ($pass ne $chkuserpassword){ &error("ERROR: PASSWORD ERROR","你输入了错误的密码!","2");}
if (($newpass eq "") &&(@userlevel[0] <=8)) {
do "$home_dir/ad_changall_html.pl";
&changall_html;
&tailer;
exit;
} elsif (($newpass eq "") &&(@userlevel[0] > 8)) {
do "$home_dir/ad_admin_html.pl";
&admin_html;
&tailer;
exit;
}else {
if (($repass eq "") || ($repass ne $newpass)) {
&error("ERROR: Repassword error","两次输入的密码不同!","2"); #重复密码错误
}else {
do "$home_dir/ad_repass.pl";
&repass;
&tailer;
exit;
}
}
if ($check == 0){ &error("ERROR: NO this user","无法确认你的身份!","2"); }
}
}
############# 错误提示 #######################################################
sub error {
&header;
($error, $message,$refresh) = @_;
if ($refresh == 2) {$where = "$fullurl?$userinfo";}
else { $where = "javascript:history.go(-1)"; }
print "<center><h1>$error<br><br>\n";
print "$message</h1><br><br>[<A HREF=\"$where\" onMouseOver=\"window.status='按此,返回前一页面!'; return true\" onMouseOut=\"window.status=''; return true\">请重新尝试</A>]</center>";
&tailer;
exit;
}
################遍历档案##########################
sub searchuser{
opendir(STAT,"$homedir/$_[0]") || &error("无法打开目录\"$_[0]\"");
@dir = grep(!/^\./, readdir(STAT));
closedir(STAT);
return@dir;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -