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

📄 announcement.php

📁 一个简单的网站管理系统,他能实现你所需要的功能,是个值得一看的系统
💻 PHP
字号:
<?php
/*
*######################################
* PHPCMS v2.00 - Advanced Content Manage System.
* Copyright (c) 2004-2005 phpcms.cn
*
* For further information go to http://www.phpcms.cn/
* This copyright notice MUST stay intact for use.
*######################################
*/

if(!defined('IN_PHPCMS')) {
        exit('Access Denied');
}

$action = $action ? $action : 'manage' ;

switch($action){
case 'add':
     if($submit){
	   if(strpos($fromtime, "-")) {
		$time = explode("-", $fromtime);
		$fromtime = gmmktime(0, 0, 0, $time[1], $time[2], $time[0]);
	   }else{
		$fromtime = 0;
	   }
	   if(strpos($totime, "-")) {
		$time = explode("-", $totime);
		$totime = gmmktime(0, 0, 0, $time[1], $time[2], $time[0]) - $timeoffset * 3600;
	   }else{
		$totime = 0;
	   }

	   if(!$fromtime) {
		showmessage('您必须输入起始时间,请返回修改。');
	   }elseif(!trim($title) || !trim($content)) {
		showmessage('您必须输入公告标题和内容,请返回修改。');
	   }else{
		$db->query("INSERT INTO $table_announcement (author, title, fromtime, totime, content,addtime) VALUES ('$_SESSION[phpcms_username]', '$title', '$fromtime', '$totime', '$content','$timestamp')");
                $referer='?file=html&action=announcement&announceid='.$db->insert_id();
		showmessage('操作成功!',$referer);
	   }
     }else{
           $today=date("Y-m-d",$timestamp);
           include template('announcement_add',1);
     }
     break;

case 'edit':
     if($submit){
	   $title = dhtmlspecialchars($title);
	   if(strpos($fromtime, "-")) {
		 $time = explode("-", $fromtime);
	         $fromtime = gmmktime(0, 0, 0, $time[1], $time[2], $time[0]) - $timeoffset * 3600;
	   }else{
		 $fromtime = 0;
	   }
	   if(strpos($totime, "-")) {
		 $time = explode("-", $totime);
		 $totime = gmmktime(0, 0, 0, $time[1], $time[2], $time[0]) - $timeoffset * 3600;
	   }else{
		 $totime = 0;
	   }

	   if(!$fromtime) {
		 showmessage('您必须输入起始时间,请返回修改。');
	   }elseif(!trim($title) || !trim($content)){
		 showmessage('您必须输入公告标题和内容,请返回修改。');
	   }else{
		 $db->query("UPDATE $table_announcement SET title='$title', fromtime='$fromtime', totime='$totime', content='$content' WHERE announceid='$announceid'");
                 $referer='?file=html&action=announcement&announceid='.$announceid;
		 showmessage('操作成功!',$referer);
	   }
     }else{
           $query="select * from $table_announcement where announceid='$announceid'";
           $result=$db->query($query);
           $r=$db->fetch_array($result);
           $r[fromtime]=date('Y-m-d',$r[fromtime]);
           $r[totime]=$r[totime] ? date('Y-m-d',$r[totime]) : '';
           $r[content]=htmlspecialchars(stripslashes($r[content]));
           include template('announcement_edit',1);
     }
     break;

case 'manage':
     $announcements = '';
     $query = $db->query("SELECT * FROM $table_announcement ORDER BY announceid DESC");
     while($announce=$db->fetch_array($query)){
           $announce[fromtime]=date('Y-m-d',$announce[fromtime]);
           $announce[totime]=$announce[totime] ? date('Y-m-d',$announce[totime]) : '';
           $announce[addtime]=date('Y/md',$announce[addtime]);
           $announces[]=$announce;
     }

     include template('announcement_manage',1);
     break;

case 'delete':
      if(empty($announceid)){
          showmessage('非法参数!请返回!');
      }
      $announceids=is_array($announceid) ? implode(',',$announceid) : $announceid;
      $db->query("DELETE FROM $table_announcement WHERE announceid IN ($announceids)");
      
      showmessage('操作成功!');
      break;
}
?>

⌨️ 快捷键说明

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