📄 t_manage.cgi
字号:
#!/perl/bin/perl
require "./setup.cgi";
use CGI;
$co=new CGI;
$upload=$co->param('upload');
$name=$co->cookie('name');
$key=$co->cookie('key');
$kind=$co->param('kind');
$admin=$co->param('admin');
$changeid=$co->param('changeid');
if ($changeid) {&changeinfo;exit;}
if ($admin) {&manage;exit;}
open (f,"$adminpath/$name.cgi") or &error("未知错误");
@t_data=<f>;
close f;
&del(@t_data);
unless ($key eq $t_data[0]) {&error("密码错误");}
$artical=$co->param('artical');
$content=$co->param('content');
unless ($artical) {&error("标题未填写完整");}
unless ($content) {$content="NONE";}
$t_data[2]++; #统计文章数,作者每写一篇文章,则总数加1
open (f,">$adminpath/$name.cgi");
foreach $t_data(@t_data) {print f "$t_data\n";}
close f;
open (f,">$realpath/$kind/$name$t_data[2].dat"); #写入文章标题和内容
print f "$artical\n";
print f "$content\n";
close f;
print $co->header(-charset=>'gb2312');
if ($upload eq "yes") #判断是否有附件上传
{
print qq~
<html>
<head><title>上传附件</title></head>
<body>
<script src=top.js></script>
<br>
<center>
<form method="POST" action="upload.cgi" ENCTYPE="multipart/form-data">
附件1: <input type="file" name="FILE1"> <br>
附件2: <input type="file" name="FILE2"> <br>
附件3: <input type="file" name="FILE3"> <br>
附件4: <input type="file" name="FILE4"> <br>
附件5: <input type="file" name="FILE5"> <br>
<input type=hidden name=loadname value=$name$t_data[2]>
<input type=hidden name=kind value=$kind>
<input type="submit" value="确定">
</form>
</center>
<br>
<script src=buttom.js></script>
</body>
</html>
~;
}
else
{
print qq~
<html>
<head><title>本窗口在5秒后自动关闭</title></head>
<body>
<script language="JavaScript">
setTimeout("self.close()",5000)
</script>
<script src=top.js></script>
<br>
<center>
<font color=red size=5>添加成功</font><br><br><br><br>
<p align="center">【<a href="javascript:window.close()"><font color=blue size=3>关闭</font></a>】</p>
<br>
<script src=buttom.js></script>
</body>
</html>
~;
}
sub manage
{
unless (($name eq $supername)&&($key eq $superkey)) {&error("你没有管理员的权限");}
$id=$co->param('id');
if ($admin eq "del")
{
if (-e "$userpath/$id.cgi") {unlink ("$userpath/$id.cgi");}
elsif (-e "$adminpath/$id.cgi") {unlink ("$adminpath/$id.cgi");}
else {&error("未知错误");}
print $co->header(-charset=>'gb2312');
print qq~
<html>
<head><title>本窗口在5秒后自动关闭</title></head>
<body>
<script language="JavaScript">
setTimeout("self.close()",5000)
</script>
<script src=top.js></script>
<br>
<center>
<font color=red size=5>删除成功</font><br><br><br><br>
<p align="center">【<a href="javascript:window.close()"><font color=blue size=3>关闭</font></a>】</p>
<br>
<script src=buttom.js></script>
</body>
</html>
~;
}
elsif ($admin eq "see")
{
if (-e "$userpath/$id.cgi")
{
open(f,"$userpath/$id.cgi");
@info=<f>;
close f;
&del(@info);
@tmpkind=split(/=/,$info[1]);
foreach $tmpkind(@tmpkind)
{$kindinfo.="$classkind{$tmpkind} ";}
print $co->header(-charset=>'gb2312');
print qq~
<html>
<head><title>$id资料</title></head>
<body>
<script src=top.js></script>
<br>
<table border=0 width=750 align=center>
<tr>
<td width=20%> </td>
<td align=left>
用 户 名: $id<br><br>
密 码: $info[0]<br><br>
课 程: $kindinfo<br><br>
真实姓名: $info[2]<br><br>
邮 箱: $info[3]<br><br>
剩余时间: $info[5](秒)<br><br>
性 别: $info[6]<br><br>
城 市: $info[7]<br><br>
通信地址: $info[8]<br><br>
邮政编码: $info[9]<br><br>
联系电话: $info[10]<br><br>
职 业: $info[13]<br><br>
婚姻状况: $info[12]<br><br>
最高学历: $info[11]
</td>
</tr>
</table>
<br>
<script src=buttom.js></script>
</body>
</html>
~;
}
elsif (-e "$adminpath/$id.cgi")
{
open(f,"$adminpath/$id.cgi");
@info=<f>;
close f;
&del(@info);
@tmpkind=split(/=/,$info[1]);
foreach $tmpkind(@tmpkind)
{$kindinfo.="$classkind{$tmpkind} ";}
print $co->header(-charset=>'gb2312');
print qq~
<html>
<head><title>$id资料</title></head>
<body>
<script src=top.js></script>
<br>
<table border=0 width=750 align=center>
<tr>
<td width=20%> </td>
<td align=left>
用 户 名: $id<br><br>
密 码: $info[0]<br><br>
课 程: $kindinfo<br><br>
真实姓名: $info[3]<br><br>
邮 箱: $info[4]<br><br>
性 别: $info[5]
</td>
</tr>
</table>
<br>
<script src=buttom.js></script>
</body>
</html>
~;
}
else {&error("找不到$id文件");}
}
elsif ($admin eq "change")
{
if (-e "$userpath/$id.cgi") {&error("不能修改普通会员资料");}
elsif (-e "$adminpath/$id.cgi")
{
print $co->header(-charset=>'gb2312');
print qq~
<html>
<head><title>修改资料</title></head>
<body>
<script src=top.js></script>
<br>
<center>
<form action=t_manage.cgi method=post>
课程类别:<input type=checkbox value=aA name=classname> classA
<input type=checkbox value=bA name=classname> classB
<input type=checkbox value=cA name=classname> classC<br><br>
<input type=submit value=" 确 定 " name=submit>
<input type=hidden name=changeid value=$id>
</form>
</center>
<br>
<script src=buttom.js></script>
</body>
</html>
~;
}
else {&error("未知错误");}
}
else {&error("未知错误");}
}
sub changeinfo
{
unless (-e "$adminpath/$changeid.cgi") {&error("找不到$changeid文件");}
@classname=$co->param('classname');
open (f,"$adminpath/$changeid.cgi");
@data=<f>;
close f;
&del(@data);
$data[1]=join("=",@classname);
open (f,">$adminpath/$changeid.cgi");
foreach $data(@data) {print f "$data\n";}
close f;
print $co->header(-charset=>'gb2312');
print qq~
<html>
<head><title>本窗口在5秒后自动关闭</title></head>
<body>
<script language="JavaScript">
setTimeout("self.close()",5000)
</script>
<script src=top.js></script>
<br>
<center>
<font color=red size=5>修改完成</font><br><br><br><br>
<p align="center">【<a href="javascript:window.close()"><font color=blue size=3>关闭</font></a>】</p>
<br>
<script src=buttom.js></script>
</body>
</html>
~;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -