📄 manage.php
字号:
<?
if($password != "mypassword")header("Location:http://www.php2000.com");
$filename = "downloadata.php";
$message = file($filename);
if( ($action == "add") && ($id != "") )
{
$handle = fopen($filename,"a");
fputs($handle,"$id||$idcn||\r\n");
fclose($handle);
$message = file($filename);
$action = "";
if(!file_exists("$id/$id.php"))
{
mkdir($id,0777);
$handle = fopen("$id/$id.php","w");
fputs($handle,"0");
fclose($handle);
}
}
else if( ($action == "delete") && ($id != "") )
{
$handle = fopen($filename,"w");
fputs($handle,$message[0]);
for($i=1;$i<count($message);$i++)
{
if($i != $id)
{
fputs($handle,$message[$i]);
}
}
fclose($handle);
$message = file($filename);
}
for($i=0;$i<count($message);$i++)
{
$msg[$i]=split("\|\|",$message[$i],99);
}
?>
<html>
<head>
<title>文章管理程序</title>
<meta http-equiv="目录类型" content="文本/html; 字符集=gb2312">
<link rel="stylesheet" type="text/css" href="../default.css">
</head>
<body bgcolor="#FFFFFF" leftmargin="4" topmargin="4">
<center>
<table width="770" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="176" height="60" valign="top"><img src="../image/logo.jpg" width="176" height="60"></td>
<td width="468" height="60" align="center" valign="top">
<p><a href="http://www.stockfane.com" target="_blank"><img src="../image/sflogo.gif" width="470" height="61" border="0"></a>感谢库存信息港提供PHP主页空间 </p>
</td>
<td height="60" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td>
<script>document.write("<a href=http://top1.263.net/count/top.dll?Type=sharkpwd&id=A7908&ReferID=A7908 target=_blank>");document.write("<img src=http://top1.263.net/count/top.dll?Type=Img5&add=1&id=A7908&refer="+escape(top.document.referrer)+" border=0 alt=263统计计数器>");document.write("</a>");</script>
</td>
</tr>
<tr align="center">
<td><? print(date("Y年m月d日")); ?> </td>
</tr>
<tr align="center">
<td>-_-</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="770" border="0" cellspacing="0" cellpadding="2" height="20" bgcolor="99cc99">
<tr align="right">
<td><?print($id);?> <<: <a href="manage.php?password=<?print($password);?>">文章管理</a> << <a href="../index.html">主页</a></td>
</tr>
</table>
<?
if($action != "view")
{
?>
<table width="600" border="1" cellspacing="0" cellpadding="2" bordercolorlight="e0e0e0" bordercolordark="ffffff">
<form method=POST action=manage.php?action=view>
<input type=hidden name=password value=<?print($password);?>>
<tr bgcolor="99cc99">
<td height="20" align="center" colspan="9"><font size="3">文章管理程序</font></td>
</tr>
<tr bgcolor="f0f0f0">
<td align="right"> </td>
<td align="center">中文名称</td>
<td align="center">英文目录</td>
<td align="center">功能</td>
<td align="center" bgcolor="99cc99"> </td>
<td align="center"> </td>
<td align="center">中文名称</td>
<td align="center">英文目录</td>
<td align="center">功能</td>
</tr>
<?
for($i=1;$i<count($message);$i=$i+2)
{
?>
<tr bgcolor="f0f0f0">
<td align="right">
<input type="radio" name="id" value="<? print($msg[$i][0]); ?>">
</td>
<td><? print($msg[$i][1]); ?></td>
<td> <? print($msg[$i][0]); ?> </td>
<td align="center">
<input type="button" value="删除类别" name="按钮" onClick=javascript:self.location="manage.php?password=<?print($password);?>&&action=delete&&id=<? print($i); ?>">
</td>
<td align="center" bgcolor="99cc99"> </td>
<td align="center">
<input type="radio" name="id" value="<? print($msg[$i+1][0]); ?>">
</td>
<td align="center"><? print($msg[$i+1][1]); ?></td>
<td align="center"><? print($msg[$i+1][0]); ?></td>
<td align="center">
<input type="button" value="删除类别" name="按钮2" onClick=javascript:self.location="manage.php?password=<?print($password);?>&&action=delete&&id=<? print($i+1); ?>">
</td>
</tr>
<?
}
?>
<tr bgcolor="f0f0f0" align="center">
<td colspan="9">
<input type="submit" name="manage" value="开始管理">
</td>
</tr>
</form>
<form method=post action=manage.php?action=add>
<input type=hidden name=password value=<?print($password);?>>
<tr bgcolor="f0f0f0">
<td align="right">
<input type="radio" name="id" value="<? print($i); ?>">
</td>
<td>
<input type="text" name="idcn" size="10" maxlength="30">
</td>
<td>
<input type="text" name="id" size="10" maxlength="30">
</td>
<td align="center" colspan="6">
<input type="submit" name="typeadd" value="增加类别">
</td>
</tr>
</form>
</table>
<?
}
else
{
$message = file("$id/$id.php"); //更新最大文章数
$maxnumber = chop($message[0]);
$numperpage = 10;
$totalpages = round(($maxnumber/$numperpage)+0.5);
if($page == ""){ $page = 1;}
$lastpage = $page - 1;
$nextpage = $page + 1;
if($lastpage <1)
{
$lastpage = 1;
}
if($nextpage > $totalpages)
{
$nextpage = $totalpages;
}
if( ($function == "update") && ($updateid != "") )
{
$handle = fopen("$id/$updateid.php","w");
$msg[$i][0]=$title;
$msg[$i][1]=$brief;
$msg[$i][2]=$date;
$msg[$i][3]=$downumber;
$brief = ereg_replace("<","<",$brief);
$brief = ereg_replace(">",">",$brief);
$title = ereg_replace("\"",""",$title);
fputs($handle,"$title||$date||$downumber||$subid||\r\n$brief");
fclose($handle);
$handle = fopen("$id/lastmodify.php","w");
fputs($handle,date("U"));
fclose($handle);
}
else if( ($function == "delete") && ($idel != "") )
{
unlink("$id/$idel.php");
if($idel == $maxnumber)
{
$handle = fopen("$id/$id.php","w");
$maxnumber --;
fputs($handle,$maxnumber);
fclose($handle);
}
}
else if( ($function == "tuijian") && ($idtuijian != ""))
{
$tuijian = file("tuijian.dbf");
$foundsign = 0;
for($i=0;$i<count($tuijian);$i++)
{
$tmp = split("&&php2000&&",$tuijian[$i],99);
if( ($tmp[0] == $id) && ($tmp[1] == $idtuijian))
{
$foundsign = 1;
break;
}
}
if(!$foundsign)
{
$handle = fopen("tuijian.dbf","a");
fputs($handle,$id."&&php2000&&".$idtuijian."&&php2000&&\r\n");
fclose($handle);
}
}
else if( ($function == "add") && ($title != "") && ($brief != "") )
{
if($downumber == "")
{
$downumber = 0;
}
$message = file("$id/$id.php"); //更新最大文章数
$maxnumber = chop($message[0]);
$maxnumber ++;
if($idadd >= $maxnumber)
{
$handle = fopen("$id/$id.php","w");
fputs($handle,$idadd);
fclose($handle);
$maxnumber = $idadd;
}
else $maxnumber --;
$handle = fopen("$id/$idadd.php","w"); //增加文章
$title = ereg_replace("\"",""",$title);
fputs($handle,"$title||$date||$downumber||$subid||\r\n$brief");
fclose($handle);
$handle = fopen("$id/lastmodify.php","w");
fputs($handle,date("U"));
fclose($handle);
}
?>
<table width="770" border="0" cellspacing="0" cellpadding="2" bgcolor="f0f0f0" bordercolorlight="e0e0e0" bordercolordark="ffffff">
<tr align="center">
<td height="20" bgcolor="99cc99" colspan="6">一共<?print($maxnumber);?>篇,每页显示<?print($numperpage);?>篇,共<?print($totalpages);?>页,当前是第<? print($page);?>页</td>
</tr>
<tr align="center">
<td height="20" colspan="6"> <?
print("[<a href=manage.php?id=$id&&action=view&&page=$lastpage&&password=$password>上一页</a>][<a href=manage.php?id=$id&&action=view&&page=$nextpage&&password=$password>下一页</a>]");
for($i=1;$i<=$totalpages;$i++)
{
print("[<a href=manage.php?id=$id&&action=view&&page=$i&&password=$password>$i</a>]");
}
?> </td>
</tr>
<form action = manage.php?id=<? print($id); ?>&&action=view&&function=add method=post>
<input type=hidden name=password value=<?print($password);?>>
<tr align="center">
<td height="30" bgcolor="99cc99" width="70">编号</td>
<td height="30" bgcolor="99cc99" width="179">子类</td>
<td height="30" width="329" bgcolor="99cc99">文章标题</td>
<td height="30" bgcolor="99cc99" width="82">更新时间</td>
<td height="30" bgcolor="99cc99" width="40">次数</td>
<td height="30" bgcolor="99cc99" width="46">操作</td>
</tr>
<tr align="center">
<td height="50" bgcolor="e0e0e0" width="70">
<input type="text" name="idadd" value="<?print($maxnumber+1);?>" size="10" maxlength="20">
</td>
<td height="50" bgcolor="e0e0e0" width="179">
<?
@$message = file("$id/$maxnumber.php");
$msg = split("\|\|",$message[0],99);
?>
<input type="text" name="subid" size="10" maxlength="20" value="<?print($msg[3])?>">
</td>
<td height="50" width="329" bgcolor="e0e0e0">
<input type="text" name="title" size="50" maxlength="100">
</td>
<td height="50" bgcolor="e0e0e0" width="82">
<input type="text" name="date" size="12" maxlength="12" value=<? print(date("Y年m月d")); ?>>
</td>
<td height="50" bgcolor="e0e0e0" width="40">
<input type="text" name="downumber" size="5" maxlength="20">
</td>
<td height="50" bgcolor="e0e0e0" width="46">
<input type="submit" name="add" value="增加">
</td>
</tr>
<tr align="center">
<td height="50" bgcolor="e0e0e0" colspan="6"> 内容<br>
<textarea name="brief" cols="100" rows="20"></textarea>
</td>
</tr>
<tr align="center">
<td height="10" width="70"> </td>
<td height="10" width="179"> </td>
<td height="10" width="329"> </td>
<td height="10" width="82"> </td>
<td height="10" width="40"> </td>
<td height="10" width="46"> </td>
</tr>
</form>
<?
$bgcolor[0]="f0f0f0";
$bgcolor[1]="e0e0e0";
$begin = $maxnumber - ($page-1)*$numperpage;
for($i=$begin;($i>$begin-$numperpage)&&($i>0);$i--)
{
if(!file_exists("$id/$i.php")){ continue;}
$message = file("$id/$i.php");
$msg = split("\|\|",stripslashes($message[0]),99);
?>
<form action = manage.php?id=<? print($id); ?>&&action=view&&function=update&&updateid=<? print($i); ?> method=post>
<input type=hidden name=password value=<?print($password);?>>
<input type=hidden name=page value=<?print($page);?>>
<tr align="center">
<td height="30" bgcolor="99cc99" width="70">编号</td>
<td height="30" width="179" bgcolor="99cc99">子类</td>
<td height="30" width="329" bgcolor="99cc99">文章标题</td>
<td height="30" bgcolor="99cc99" width="82">更新时间</td>
<td height="30" bgcolor="99cc99" width="40">次数</td>
<td height="30" bgcolor="99cc99" width="46">操作</td>
</tr>
<tr align="center" valign="middle">
<td height="50" bgcolor="<? print($bgcolor[$i%2]); ?>" width="70"><?print($i);?><br>
<input type="button" name="tuijian" value="推荐" onClick=javascript:self.location="manage.php?password=<?print($password);?>&&id=<? print($id); ?>&&action=view&&function=tuijian&&idtuijian=<? print($i); ?>">
<br>
</td>
<td height="50" width="179" bgcolor="<? print($bgcolor[$i%2]); ?>">
<input type="text" name="subid" size="10" maxlength="20" value="<?print($msg[3])?>">
</td>
<td height="50" width="329" bgcolor="<? print($bgcolor[$i%2]); ?>">
<input type="text" name="title" size="50" maxlength="100" value="<? print($msg[0]); ?>">
</td>
<td height="50" bgcolor="<? print($bgcolor[$i%2]); ?>" width="82">
<input type="text" name="date" size="12" maxlength="12" value="<? print($msg[1]); ?>">
</td>
<td height="50" bgcolor="<? print($bgcolor[$i%2]); ?>" width="40">
<input type="text" name="downumber" size="5" maxlength="20" value="<? print($msg[2]); ?>">
</td>
<td height="50" bgcolor="<? print($bgcolor[$i%2]); ?>" width="46">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td>
<input type="submit" name="update" value="更新">
</td>
</tr>
<tr align="center">
<td>
<input type="button" name="delete" value="删除" onClick=javascript:self.location="manage.php?password=<?print($password);?>&&id=<? print($id); ?>&&action=view&&function=delete&&idel=<? print($i); ?>">
</td>
</tr>
</table>
</td>
</tr>
<tr align="center" valign="middle">
<td height="100" bgcolor="<? print($bgcolor[$i%2]); ?>" colspan="6"> 简介<br>
<textarea name="brief" cols="100" rows="10">
<?
for($k=1;$k<count($message);$k++)
{
$message[$k] = ereg_replace("<","<",$message[$k]);
$message[$k] = ereg_replace(">",">",$message[$k]);
print(stripslashes($message[$k]));
}
?>
</textarea>
</td>
</tr>
<tr align="center">
<td height="1" colspan="6" bgcolor="b0b0b0"></td>
</tr>
</form>
<?
}
?>
</table>
<?
}
?>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -