📄 announcesys.php
字号:
<?
$forumid=125;
require("global.php");
require("ofstarcode.php");
require("userdata/style.php");
$idm_unique=$data_path;
$add_title=" > 公告中心";
$msgg_max=100;#系统记录的最大公告数目
$pagesize=10;#每页显示数目
if ($job=="") $job=show;
if ($login_status==1 && ($username==$manager ||($manager && in_array($username,$manager)))) {$announceadmin=1;}
//----让增加的管理员有权管理!----------
if (file_exists("bbsdata/superadmin.php")) {
include("bbsdata/superadmin.php");
if ($superadmin && in_array($username,$superadmin)) {
$announceadmin=1;
}
}
//----让增加的管理员有权管理!----------
$musia=0;
if ($announceadmin==1) $musia=1;
if (file_exists("bbsdata/tbuser.php")) {
include("bbsdata/tbuser.php");
if ($tbuser && in_array($username,$tbuser)) $musia=1;
}
if($login_status!=1 || $musia!=1) $not_member=1;
if (!isset($page)) $page=1;
?>
<?
if (!$login_status) {echo "对不起,您还未登录"; exit;}
$user=$username;
if ($job=="read") {
if (file_exists("bbsdata/announcesys.php")) {
$receivelist=file("bbsdata/announcesys.php");
list($author,$title,$time,$content,$member)=explode("|",$receivelist[$msg]);
$ctime=getfulldate($time);
if ($member=="1" && $not_member=="1") $content="特别会员公告,申请加入会员才能看见!";
$content=convert($content,$ftbcode_post);
echo "
<html>
<head><title>公告内容</title>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">
<style type=\"text/css\">
<!--
p,td,input,select{ font-size: 9pt; color:#333333;}
a {color:#333333;font-size: 9pt;text-decoration:none; }
a:hover {color:#000000;text-decoration:underline overline;}
a:active {color:#FF6699;}
-->
</style>
</head>
<body bgcolor={$backgroundcolor} leftmargin=0 topmargin=10 marginwidth=0>
<table cellpadding=0 cellspacing=0 border=0 bgcolor={$bordercolor} align=center width=100%>
<tr><td><table cellpadding=5 cellspacing=1 border=0 width=100%>";
echo "
<tr>
<td colspan=2 bgcolor={$titlecolor}><b class=title>-=> 阅读公告 </b></td>
</tr>
<tr>
<td bgcolor={$forumcolortwo}><br><font color=5A6633>时 间:</font>$ctime<br><font color=5A6633>发布者:</font>$author<br><font color=5A6633>题 目:</font>$title<br><font color=5A6633>内 容:</font>$content";
echo "</td>
</tr><tr><td colspan=2 bgcolor={$titlecolor}><div align=center><a href=\"announcesys.php\">查看更多公告记录</a> <a href=javascript:window.close()>关闭窗口</a></div></td></tr></table>
</td>
</tr>
</table>
</body>
</html>";
}
}
if ($job=="show") {
require("header.php");echo"$headertp";
headguide('你现在正在社区的公告中心','公告中心','','no');
if (file_exists("bbsdata/announcesys.php")) {
$receivelist=file("bbsdata/announcesys.php");
$count=count($receivelist);
$sum=$count-1;
$totalpage=ceil($sum/$pagesize);
if ($page>$totalpage || $page<=0) {
$page=1;
}
if ($totalpage==0) {
$totalpage=1;
$page=1;
}
//$start=$sum-$pagesize*($page-1);
//$end=$start-$pagesize;
$start=$pagesize*($page-1);
$end=$start+$pagesize;
if ($count<=1 && empty($receivelist[0])) {
echo "<table cellpadding=0 cellspacing=0 border=0 width={$tablewidth} bgcolor=bgcolor={$titlecolor} align=center>
<tr><td>";
echo"<center><br>暂时没有任何公告</center>";
echo "</td></tr></table>";
if ($announceadmin) {echo "<table bgcolor={$forumcolortwo} width={$tablewidth} border=0 cellspacing=0 cellpadding=2 align=center><tr align=center><td>";
echo " [<a href=announcesys.php?job=clear>清空</a>] [<a href=announcesys.php?job=write>发布</a>] [<a href=announcesys.php?job=showzt>状态</a>]";
echo "</td></tr></table>";}
require("footer.php");echo"$footertp";exit;}
if ($announceadmin) {echo "<table bgcolor={$forumcolortwo} width={$tablewidth} border=0 cellspacing=0 cellpadding=2 align=center><tr align=center><td>";
echo " [<a href=announcesys.php?job=clear>清空</a>] [<a href=announcesys.php?job=write>发布</a>] [<a href=announcesys.php?job=showzt>状态</a>]";
echo "</td></tr></table>";}
sline_an();
for ($i=$start; $i<$end; $i++) {
if ($i>$sum) break;
list($author,$title,$time,$content,$member)=explode("|",$receivelist[$i]);
$time=getfulldate($time);
$content=convert($content,$ftbcode_post);
if ($member=="1" && $not_member=="1") $content="特别会员公告,申请加入会员才能看见!";
echo "
<tr>
<td colspan=2 bgcolor={$titlecolor}><b class=title>-=> 题目:$title </b></td>
</tr>
<tr>
<td bgcolor={$forumcolortwo}>";
echo "<table width={$tablewidth} border=0 cellspacing=0 cellpadding=2 align=center>";
echo "<tr align=left><td></td></tr>
<tr align=left><td>$content</td></tr><tr align=left><td><br><br>时间:$time 发布者:$author</td>
<td>";
if ($announceadmin==1)echo "<br><br>[<a href='announcesys.php?job=delone&msg=$i'>删除</a>]";
echo "</td></tr></table>";
sline_an();
}
}
else {echo "<center><br>暂时没有任何公告</center>";
if ($announceadmin) {echo "<table bgcolor={$forumcolortwo} width={$tablewidth} border=0 cellspacing=0 cellpadding=2 align=center><tr align=center><td>";
echo " [<a href=announcesys.php?job=clear>清空</a>] [<a href=announcesys.php?job=write>发布</a>] [<a href=announcesys.php?job=showzt>状态</a>]";
echo "</td></tr></table>";}
require("footer.php");echo"$footertp"; exit; }
echo "</td></tr></table></td></tr></table><br>";
pagenum();
require("footer.php");echo"$footertp";
}
if ($job=="write") {
if ($announceadmin!=1) {require("header.php");echo"$headertp";
echo "<center>对不起,未登陆或者身份不正确,请 <a href='javascript:history.back(1);'>返回检查</a></center>";
require("footer.php");echo"$footertp";
exit;}
if (empty($step)) {require("header.php");echo"$headertp";
headguide('你现在正在社区的公告发布中心','发布公告','','no');
print_form();
require("footer.php");echo"$footertp";
}
elseif($step==2) {
if (empty($content) || empty($title) || $announceadmin!=1) {
echo "<center>对不起,未登陆或者身份不正确,请 <a href='javascript:history.back(1);'>返回检查</a></center>";
exit;
}
if (file_exists("bbsdata/announcesys.php")) $msg=file("bbsdata/announcesys.php");
else $msg[0]="";
$content=stripslashes(safe_convert($content));
$title=stripslashes(safe_convert($title));
$title="".$title;
$new="$user|$title|$timestamp|$content|$membern\n";
$oldcount=count($msg);
if ($oldcount>$msgg_max) {
for ($i=$msgg_max; $i<$oldcount; $i++) unset($msg);
}
$old=implode("",$msg);
writetofile("bbsdata/announcesys.php",$new.$old);
require("header.php");echo"$headertp";
headguide($des,"<a href='announcesys.php'>发布公告中心</a>");
msg_box("已经成功发布",
"<b>POST程式成功完成了发布公告</b><br>
你现在可以选择:<br><ul><li><a onfocus=this.blur() href='javascript:history.back(1)'>返回前页</a><br>
<br></li>
<li><a onfocus=this.blur() href='announcesys.php'>查看公告</a><br>
<br></li>
<li><a onfocus=this.blur() href='index.php'>返回论坛首页</a></li></ul>");
require("footer.php");echo"$footertp";
exit;
}
}
if ($job=="clear") {
if ($announceadmin!=1) {require("header.php");echo"$headertp";
echo "<center>对不起,未登陆或者身份不正确,请 <a href='javascript:history.back(1);'>返回检查</a></center>";
require("footer.php");echo"$footertp";
exit;}require("header.php");echo"$headertp";
headguide($des,"<a href='announcesys.php'>发布公告中心</a>");
msg_box("确认清空?",
"<b>确认清空所有发布的公告?</b><br>
你现在可以选择:<br><ul><li><a onfocus=this.blur() href='javascript:history.back(1)'>返回前页</a><br>
<br></li>
<li><a onfocus=this.blur() href='announcesys.php?job=yesclear'>确认清空</a><br>
<br></li>
<li><a onfocus=this.blur() href='index.php'>返回论坛首页</a></li></ul>");
require("footer.php");echo"$footertp";
exit;
}
if ($job=="yesclear") {
if ($announceadmin!=1) {require("header.php");echo"$headertp";
echo "<center>对不起,未登陆或者身份不正确,请 <a href='javascript:history.back(1);'>返回检查</a></center>";
require("footer.php");echo"$footertp";
exit;}
if (file_exists("bbsdata/announcesys.php")) unlink("bbsdata/announcesys.php");
require("header.php");echo"$headertp";
headguide($des,"<a href='announcesys.php'>发布公告中心</a>");
jump_page("announcesys.php","已经清空",
"
你现在可以选择:<br><ul><li><a onfocus=this.blur() href='javascript:history.back(1)'>返回前页</a><br>
<br></li>
<li><a onfocus=this.blur() href='index.php'>返回论坛首页</a></li></ul>");
require("footer.php");echo"$footertp";
exit;
exit;
}
if ($job=="delone") {
if ($announceadmin!=1) {require("header.php");echo"$headertp";
echo "<center>对不起,未登陆或者身份不正确,请 <a href='javascript:history.back(1);'>返回检查</a></center>";
require("footer.php");echo"$footertp";
exit;}
if (file_exists("bbsdata/announcesys.php")) {
$receivelist=file("bbsdata/announcesys.php");
$count=count($receivelist);
$fp=fopen("bbsdata/announcesys.php","w");
for ($i=0; $i<$count; $i++) {
if ($i!=$msg) fputs($fp,$receivelist[$i]);
}
fclose($fp);
echo "<br>成功删除一条公告<meta http-equiv=\"refresh\" content=\"0;URL=announcesys.php\">";
exit;
}
}
if ($job=="showzt") {
if ($announceadmin!=1) {require("header.php");echo"$headertp";
echo "<center>对不起,未登陆或者身份不正确,请 <a href='javascript:history.back(1);'>返回检查</a></center>";
require("footer.php");echo"$footertp";
exit;}
if (file_exists("bbsdata/announcesys.php")) {
$receivelist=file("bbsdata/announcesys.php");
$count=count($receivelist);
$contl=($count/$msgg_max)*100;
require("header.php");echo"$headertp";
headguide($des,"<a href='announcesys.php'>发布公告中心</a>");
msg_box("公告使用状态",
"<b>目前有公告<font color=red>$count</font>条<br></b><br>
具体细节:<br><ul><li>最多可存公告<font color=red>$msgg_max</font>条<br>
<br></li>
<li>使用率<font color=red>$contl%</font><br>
<br></li>
<li><a onfocus=this.blur() href='announcesys.php'>点这里返回公告中心</a></li></ul>");
require("footer.php");echo"$footertp";
exit;
}
}
function sline_an() {
global $tablewidth,$bordercolor;
print ("</td>
</tr></table>
</td>
</tr>
</table>
<br>
<table cellpadding=0 cellspacing=0 border=0 width={$tablewidth} bgcolor={$bordercolor} align=center>
<tr><td><table cellpadding=5 cellspacing=1 border=0 width=100%>");
}
function pagenum(){
global $sum,$pagesize,$page,$totalpage;
$sum1=$sum+1;
echo "<center>共 $sum1 篇,分 $totalpage 页,每页 $pagesize 篇,当前第 $page 页 ";
$back=$page-1;
$forward=$page+1;
if ($page==1) {
echo "首页 上一页 ";
}
else {
echo "<a href=\"announcesys.php?page=1\">首页</a> <a href=\"announcesys.php?page=$back\">上一页</a> ";
}
if ($page==$totalpage) {
echo "下一页 尾页</center><br>";
}
else {
echo "<a href=\"announcesys.php?page=$forward\">下一页</a> <a href=\"announcesys.php?page=$totalpage\">尾页</a></center><br>";
}
}
function print_form() {
global $target,$tablewidth,$bordercolor,$titlecolor,$titlefontcolor,$forumcolortwo,$backgroundcolor;
?>
<table cellpadding=0 cellspacing=0 border=0 width=<?=$tablewidth?> bgcolor=<?=$bordercolor?> align=center>
<tr><td><table cellpadding=5 cellspacing=1 border=0 width=100%>
<tr>
<td colspan=2 bgcolor=<?=$titlecolor?>><b class=title>-=> 发布公告 </b></td>
</tr><form action=announcesys.php method=POST>
<tr>
<td bgcolor=<?=$forumcolortwo?>>
会员公告:
<input type="checkbox" name="member" value=1>(?)<br>
题 目:
<input style="background-color:#FEFEFF; color:#9999FF; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#E5F0FF'" onMouseOut ="this.style.backgroundColor =''" type=text size=70 name="title">
<br>
公告内容:
<textarea style="background-color:#FEFEFF; border: 1 double #B4B4B4" onMouseOver = "this.style.backgroundColor = '#f3f3f3'" onMouseOut = "this.style.backgroundColor = ''" name="content" cols=70 rows=10></textarea>
<br>
</td>
</tr>
<tr bgcolor=<?=$backgroundcolor?>>
<td><input style="color: #000000; background-color: #f3f3f3; border-style: solid; border-width: 1" onMouseOver ="this.style.backgroundColor='#FFC864'" onMouseOut ="this.style.backgroundColor='#f3f3f3'" type=submit value="提 交">
<input type=hidden name=job value=write>
<input type=hidden name=step value=2>
</td>
</tr></form>
</table>
</td>
</tr>
</table>
<?}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -