⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adm_bulletin.php

📁 这个版本只是修正了一些BUG
💻 PHP
字号:
<?php
/************************************************
	adm_bulletin.php -

	Version  : 1.2
	Author   : Tracemouse (tracemouse@msn.com)
	Copyright: http://www.vitci.com
	Writed   : 2003/08/20
	Modified : 2004/04/19
*************************************************/
require "./common.php";

if ((!$editsubmit)&&(!$listsubmit)) //未发送表单
{
	if ($action == 'add')   //添加页面
    	{
		$dis_author = '';
		$dis_subject = '';
		$dis_message = '';
		$display = 'edit';
	}
	elseif ($action == 'chg')      //修改页面
    	{
		$query = $db->query("select * from $table_bulletins where id=$id");
 		if($dbq_rec = $db->fetch_array($query))
        	{
       			$dis_author = $dbq_rec['poster'];
    			$dis_time = gmdate("$dateformat $timeformat", $dbq_rec['posttime']);
    			$dis_subject = dhtmlspecialchars($dbq_rec['subject']);
    			$dis_message = dhtmlspecialchars($dbq_rec['message']);
   		}
 		$display = 'edit';
	}
	else                                //列表页面
	{
        	$bulletinlist = array();
 		$query = $db->query("SELECT * FROM $table_bulletins ORDER BY id DESC");
 		while($dbq_rec = $db->fetch_array($query))
        	{
        		$dbq_rec['subject']=dhtmlspecialchars($dbq_rec['subject']);
   			$dbq_rec['posttime'] = gmdate("$dateformat $timeformat",$dbq_rec['posttime']);
    			$bulletinlist[] = $dbq_rec;
 		}
 		$display = 'list';
	}
}
elseif ($editsubmit)          //发送表单处理
{
	$message=dhtmlspecialchars($message);
	if($action == 'add')              //添加记录
 	{
        	$sqlstr="insert into $table_bulletins(subject,poster,message,posttime)".
        	" values('$subject','$admin_user','$message',$timestamp)";
        	if($query = $db->query($sqlstr,1))
        		gotourl($language['editsuccess'],'adm_bulletin.php');
        	else
        		gotourl($language['db_err']."<br>".$sqlstr);
 	}
 	elseif($action == 'chg')          //修改记录
 	{
        	$sqlstr="update $table_bulletins SET".
        			" subject='$subject',message='$message',posttime=$timestamp where id = $id";
        	if($query = $db->query($sqlstr,1))
        		gotourl($language['editsuccess'],'adm_bulletin.php');
        	else
        		gotourl($language['db_err'].":<br>".$sqlstr);
 	}
}
elseif ($listsubmit)      //删除记录
{
	if(is_array($delete))
    	{
  		$ids = $comma = "";
  		foreach($delete as $id)
        	{
    			$ids .= "$comma'$id'";
			$comma = ", ";
   		}
   		$db->query("DELETE FROM $table_bulletins WHERE id IN ($ids)");
  	}
  	$query=@$db->query("select * from $table_bulletins order by id");
	while($dbq_rec=$db->fetch_array($query))
	{
	 	$id=$dbq_rec[id];
	 	$sqlstr="update $table_bulletins set subject='$upd_subject[$id]' where id=$id";
		@$db->query($sqlstr,1);	
	}
  	gotourl($language['editsuccess'],'adm_bulletin.php');
}

include template('bulletin');
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -