📄 admincenter.cgi
字号:
#!/usr/bin/perl
#############################################################
# Ikonboard v2.1
# Copyright 2000 Ikondiscussion.com - All Rights Reserved
# Ikondiscussion is a trademark of Ikondiscussion.com
#
# Software Distributed by: Ikondiscussion.com
# Visit us online at http://www.ikondiscussion.com
# Email us on boards@ikondiscussion.com
#
# All files written by Matthew Mecham
#############################################################
&testsystem;
#use CGI::Carp "fatalsToBrowser"; # Output errors to browser
use CGI qw(:standard); # Saves loads of work
$CGI::POST_MAX=1024 * 150; # limit post data
$CGI::DISABLE_UPLOADS = 1; # Disable uploads
eval {
($0 =~ m,(.*)/[^/]+,) and unshift (@INC, "$1");
($0 =~ m,(.*)\\[^\\]+,) and unshift (@INC, "$1");
require "ikon.lib"; # Require ikonboard ()
require "ikonadmin.lib"; # Require Admin func()
require "data/progs.cgi"; # Require prog names
require "data/boardinfo.cgi"; # Require board info
require "data/styles.cgi"; # Require styles info
require "data/boardstats.cgi";# Require styles info
};
if ($@) {
print header(-charset=>"gb2312"); print start_html(-title=>"ib2000 出错!");
print "不能够找到文件:$@\n如果您使用的是 Windows 类操作系统,请在每一个程序中更改 require 的设置,填入绝对路径!";
print end_html; exit;
}
#################--- Begin the program ---###################
$thisprog = "admincenter.cgi";
# sort out the incoming CGI
$query = new CGI;
$action = $query -> param('action');
$inmembername = $query -> param('membername');
$inpassword = $query -> param('password');
$inmembername = &unHTML("$inmembername");
$inpassword = &unHTML("$inpassword");
if ($action eq "remove") {
$filetounlink = "$ikondir" . "install.cgi";
unlink "$filetounlink";
} # end action
$filetocheck = "$ikondir" . "install.cgi";
if (-e $filetocheck) {
print "Content-type: text/html\n\n";
print qq(
<HTML><HEAD><TITLE>安装错误</TITLE></HEAD>
<BODY BGCOLOR=#ffffff TEXT=#000000>
<H1>ib2000 错误</H1><FONT COLOR=#ff0000><B>安全警告</B>:
<br>install.cgi 文件仍然在您的服务器上,请马上利用 FTP 来将其删除!!<br>
当你删除之后,刷新本页面重新进入管理中心。</FONT></body></html>);
exit;
}
if ($action eq "login") {
print "Set-Cookie: adminname=$inmembername\;";
print "\n";
print "Set-Cookie: adminpass=$inpassword\;";
print "\n";
}
else {
$inmembername = cookie('adminname');
$inpassword = cookie('adminpass');
}
print header(-charset=>"gb2312");
&admintitle;
&getmember("$inmembername");
if (($membercode eq "ad") && ($inpassword eq $password) && ($inmembername eq $membername)) {
# Check board stats
$filetoopen = "$ikondir" . "data/allforums.cgi";
$filetoopen = &stripMETA($filetoopen);
open(FILE, "$filetoopen");
@files = <FILE>;
close(FILE);
$check = @files;
$check = "failed" unless ($check > 0);
$filetoopen = "$ikondir" . "data/allforums.bak";
$backup_file = "true" if (-e $filetoopen);
$warning = qq~<br><font face=宋体 color=#000000>环境监测:<b>通过</b></font>~;
if (($check eq "failed") && ($backup_file eq "true")) {
$warning = qq~<br><font face=宋体 color=#FF0000><b>警告!数据文件将已被破坏丢失!!</b><br><font> 请到<a href="checkboard.cgi">检测论坛</a>中恢复丢失的数据。</font>~;
}
$current_time = localtime;
$inmembername =~ s/\_/ /g;
$start_topic_ratio = $totalthreads / $totalmembers if $totalthreads;
$start_topic_ratio = substr($start_topic_ratio, 0, 4) if $totalthreads;
$posting_ratio = $totalposts / $totalmembers if $totalposts;
$posting_ratio = substr($posting_ratio, 0, 4) if $totalposts;
$start_topic_ratio = 0 if ($start_topic_ratio eq "");
$posting_ratio = 0 if ($posting_ratio eq "");
$testcookie = $ENV{HTTP_COOKIE};
if ($testcookie) {
$cookie_result = qq(Cookies 是否可用? == [通过]);
}
else {
$cookie_result = qq(<font color=#FF0000>Cookies 是否可用? == [失败]</font>);
}
$cgipath = $ENV{SCRIPT_FILENAME};
$cgipath =~ s/$thisprog//g;
$hacklog = "$ikondir" . "data/hacklog.cgi";
if (-e $hacklog) {
$last_hack_entry = (stat("$hacklog"))[9];
$longdatehack = &longdate("$last_hack_entry");
$shorttimehack = &shorttime("$last_hack_entry");
$last_hack_entry = "日志最后记录时间($longdatehack $shorttimehack)";
}
else {
$last_hack_entry = "当前的日志文件是空的";
}
print qq(
<tr><td bgcolor=#333333" ><font face=宋体 color=#FFFFFF>
<b>欢迎来到论坛管理中心</b>
</td></tr>
<tr>
<td bgcolor=#EEEEEE valign=middle align=center>
<font face=宋体 color=#333333><b>欢迎 $inmembername</b></font>
</td></tr>
<tr><td bgcolor=#FFFFFF>
</td>
</tr>
<tr>
<td bgcolor=#FFFFFF valign=middle align=left>
<font face=宋体 color=#000000>
<center>
服务器时间:<b>$current_time</b>
</center>
$warning
<hr>
<font color=#000000 face=宋体>
<p>
<b>论坛数据</b><br><br>
日志记录: $last_hack_entry
<br><br>
注册用户数:$totalmembers 人
<br>总发表主题:$totalthreads 篇
<br>总发表回复:$totalposts 篇<br>
<br>注册用户平均发表主题数:$start_topic_ratio 篇
<br>注册用户平均回复主题数:$posting_ratio 篇
<br><br>
<br>目录路径 :<font color=#FF0000>$cgipath</font> == [正确]
<br>Perl 版本:<font color=#FF0000>$]</font> == [通过]
<br>CGI.pm 版本:<font color=#FF0000>$version_needed</font> == [通过]
<br>Cookie 测试:$cookie_result
<br><br><hr>
汉化改进:<a href="mailto:webmaster\@cgier.com">山鹰糊</a><BR>
汉化版权:<a href="http://www.cgier.com/">CGI 编程者之家</a></font>
</font>
</td></tr></table></td></tr></table>
);
}
else {
&adminlogin;
}
print qq~</td></tr></table></body></html>~;
exit;
sub testsystem {
if (1 == 0) {
print "Content-type: text/html\n\n";
print qq(
<HTML><HEAD><TITLE>初始化错误</TITLE></HEAD>
<BODY BGCOLOR=#ffffff TEXT=#000000>
<H1>ib2000 出错</H1>
如果您看到这个错误信息,那么说明本程序没有正确执行,它仅仅是作为普通的 HTML 输出显示。
您必须要询问您的服务器管理员,这个目录是否有执行 CGI 程序的权限。<p></body></html>
);
exit:
}
$prog = $0;
open (PROG, $prog);
@prog = <PROG>;
close (PROG);
$perl = $prog[0];
$perl =~ s/^#!//;
$perl =~ s/\s+$//;
if ($] < 5.004) {
print "Content-type: text/html\n\n";
print qq(
<HTML><HEAD><TITLE>初始化错误</TITLE></HEAD>
<BODY BGCOLOR=#ffffff TEXT=#000000>
<H1>ib2000 出错</H1><FONT COLOR=#ff0000><B>Perl 版本警告</B>:
您选择的 Perl 路径 - <B>$perl</B>,程序检测到它的版本为 $],
而 ib2000 必须运行在 Perl 5.004 以上版本。 <U>强烈</U>
推荐您联系服务器管理员升级 Perl 到 Perl 5.004 以上版本。</FONT></body></html>);
exit;
}
$version_needed = $CGI::VERSION;
if ($version_needed < 2.4) {
print "Content-type: text/html\n\n";
print qq(
<HTML><HEAD><TITLE>初始化错误</TITLE></HEAD>
<BODY BGCOLOR=#ffffff TEXT=#000000>
<H1>ib2000 出错</H1><FONT COLOR=#ff0000><B>CGI.pm 版本警告</B>:
您使用的 CGI.pm 版本为 <B>$version_needed</B>,不能够正确运行 ib2000。<br>
ib2000 必须运行在 CGI.pm 2.40 以上版本中,推荐您联系服务器管理员升级 CGI.pm 到 2.40 以上版本。</FONT></body></html>);
exit;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -