📄 main.php
字号:
<table width="512" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#cccccc">
<td colspan="2">
<div align="center"><font color="#FFFFFF">删除程序</font></div>
</td>
</tr>
<tr bgcolor="#cccccc">
<td width="101" height="48"> 请选择分类:</td>
<td width="411" height="48">
<form name="delarticle" action="main.php?action=delete" method="post">
<p><br>
<select name="class">
<?
$fp=@file("index");
for ($i=1;$i<count($fp);$i++)
{
$info=explode("│",$fp[$i]);
echo "<option value=".$info[0];
if ($i==1) echo " selected>"; else echo ">";
echo $info[1]."</option>";
}
?>
</select>
<input type="submit" name="go" value="查看" >
</p>
</form>
</td>
</tr>
<tr bgcolor="#f8f8f8">
<td colspan="2" height="2">
<p align="center"><font color="#FF0033">请选择要删除的程序所在的分类</font></p>
</td>
</tr>
<tr bgcolor="#E8F0F8" bordercolor="#E8F0F8">
<td colspan="2" height="2">
<div align="center"></div>
</td>
</tr>
</table>
</div>
</body>
</html>
<?}
}
else
{
header ("Location: login.php?url=$PHP_SELF?action=delete");
}
}
####### 添加分类模块 ##########
elseif ($action=="addsort")
{
if ($name==$admin && $pass==$password)
{
if ($submitaddsort)
{
if ($sortname=="") showerror("分类名不能为空!");
else
{
if ($sortexp=="") $sortexp=$sortname;
$sortname=trim($sortname);
$sortexp=trim($sortexp);
$sortname=str($sortname);
$sortexp=str($sortexp);
$fp1=@file("index");
if (isset($fp1[0])) {$fp1[0]=intval($fp1[0]); $fp1[0]++;} else {$fp1[0]=1;}
$sortnum=$fp1[0];
$line=$sortnum."│".$sortname."│".$sortexp."│0\n";
$fp=fopen("index","w");
fputs($fp,"$sortnum\n");
for ($i=1;$i<count($fp1);$i++)
{
fputs($fp,"$fp1[$i]");
}
fputs($fp,"$line");
fclose($fp);
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
echo "<HTML><HEAD><TITLE>发表程序</TITLE>";
echo "<META content=\"text/html; charset=gb2312\" http-equiv=Content-Type>";
echo "<link rel=\"stylesheet\" href=\"style.css\">";
echo "<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"2;URL=main.php?action=addsort\">";
echo "</head><body topmargin=\"0\"><br>";
echo "<ul>分类已经添加成功,即将返回添加管理页面...<br>";
echo " <br>请等待...<br>";
echo " <br></font>";
echo "<a href=\"main.php?action=addsort\">如果你的浏览器没有自动的返回,或者你不想再等待,请点这里返回.";
echo "</font></a></ul>";
}
}
else
{?>
<html>
<head>
<title>添加分类</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css.css">
</head>
<body>
<div align="center">
<table width="645" border="0" cellspacing="0" cellpadding="0" height="241">
<tr>
<td colspan="2" height="20" bgcolor="cccccc">
<div align="center"><font color="#FFFFFF">添加分类</font></div>
</td>
</tr>
<tr bgcolor="#f8f8f8">
<td colspan="2">
<form name="addtype" action="main.php?action=addsort" method="post" >
<p> 分类名称:
<input type="text" name="sortname" size="20">
<font color="#FF3333">*</font></p>
<p> 分类描述:
<input type="text" name="sortexp" maxlength="60" size="60">
</p>
<p align="center">
<input type="submit" name="submitaddsort" value="提交" >
<input type="reset" name="clean" value="清空">
</p>
<p align="center"><font color="#FF3333">带*为必填项</font></p>
</form>
</td>
</tr>
<tr bgcolor="#E8F0F8" bordercolor="#E8F0F8">
<td colspan="2">
<div align="center">已经添加的分类:<br>
<?$fp=@file("index");
for ($i=1;$i<count($fp);$i++)
{
$info=explode("│",$fp[$i]);
echo "类别编号:".$info[0]." 类别名称:".$info[1]."<br>";
}?><br></div>
</td>
</tr>
<tr bgcolor="#E8F0F8" bordercolor="#E8F0F8">
<td colspan="2">
<div align="center"></div>
</td>
</tr>
</table>
</div>
</body>
</html><?
}
}
else
{
header ("Location: login.php?url=$PHP_SELF?action=addsort");
}
}
######## 删除分类模块 ##########
elseif ($action=="delsort")
{
if ($name==$admin && $pass==$password)
{
if ($submitdelsort)
{
$fp=@file("index");
$num=count($fp);
for ($i=1;$i<$num;$i++)
{
$info=explode("│",$fp[$i]);
if ($info[0]==$classnum)
{
$info[3]=intval($info[3]);
if ($info[3]!=0) { showerror("该分类中还包含有程序,请将程序删除后在删除该分类");exit();}
else{ $j=$i; }
}
}
$fp1=fopen("index","w");
fputs($fp1,$fp[0]);
for ($i=1;$i<$num;$i++)
{
if ($i!=$j) fputs($fp1,$fp[$i]);
}
fclose($fp1);
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">";
echo "<HTML><HEAD><TITLE>发表程序</TITLE>";
echo "<META content=\"text/html; charset=gb2312\" http-equiv=Content-Type>";
echo "<link rel=\"stylesheet\" href=\"style.css\">";
echo "<meta HTTP-EQUIV=\"REFRESH\" CONTENT=\"2;URL=main.php?action=delsort\">";
echo "</head><body topmargin=\"0\"><br>";
echo "<ul>分类已经成功删除,即将返回添加管理页面...<br>";
echo " <br>请等待...<br>";
echo " <br></font>";
echo "<a href=\"main.php?action=delsort\">如果你的浏览器没有自动的返回,或者你不想再等待,请点这里返回.";
echo "</font></a></ul>";
}
else
{?>
<html>
<head>
<title>删除分类</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css.css">
</head>
<body bgcolor="#FFFFFF">
<div align="center">
<table width="491" border="0" cellspacing="0" cellpadding="0" height="92">
<tr bgcolor="#f8f8f8">
<td height="2">
<div align="center"><font color="#FFFFFF">删除分类</font></div>
</td>
</tr>
<tr bgcolor="cccccc">
<td height="20">
<div align="center">
<form name="deltype" action="main.php?action=delsort" method="post">
请选择要删除的分类:
<select name="classnum">
<?
$fp=@file("index");
for ($i=1;$i<count($fp);$i++)
{
$info=explode("│",$fp[$i]);
echo "<option value=".$info[0];
if ($i==1) echo " selected>"; else echo ">";
echo $info[1]."</option>";
}
?>
</select>
<p>
<input type="submit" name="submitdelsort" value="删除">
</p>
</form>
</div>
</td>
</tr>
<tr bgcolor="#E8F0F8">
<td height="2">
<div align="center"></div>
</td>
</tr>
</table>
</div>
</body>
</html><?}
}
else
{
header ("Location: login.php?url=$PHP_SELF?action=delsort");
}
}
########## 管理首页显示模块 ###########
else
{?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="css.css">
</head>
<body>
<div align="center">
<table width="551" border="0" cellspacing="0" cellpadding="0">
<tr bgcolor="#f8f8f8">
<td> </td>
</tr>
<tr bgcolor="ffffff">
<td>
<p>欢迎您使用新易设计(Siny Design)程序管理系统,有任何问题请到我的主页留言本说http://siny.ahut.edu.cn/</font></p>
<p>或者到我的论坛提出,<a href="http://www.zsdy.cn/008" target="_blank">点击此处进入论坛</a></font></p>
</td>
</tr>
</table>
</div>
</body>
</html>
<?}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -