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

📄 edit.php

📁 程序安装简便容易
💻 PHP
字号:
<?php
!$_SERVER['PHP_SELF'] && $_SERVER['PHP_SELF']=$_SERVER['SCRIPT_NAME'];
substr($_SERVER['PHP_SELF'],-9,-4)!=='admin' && exit('Forbidden');

require_once(R_P.'cache/set.php');

if(!empty($_GET['type'])) {
	if($_GET['type']=='news') {
		if(!empty($_GET['do']) && $_GET['do']==='edit') {
			$id=$_GET['id'];
			$rs=get_one("SELECT * FROM duoxun_news WHERE aid=$id");
		 	  $select_color_a=$rs['title_color']=='White' ? ' selected' : '';
		  	  $select_color_b=$rs['title_color']=='Black' ? ' selected' : '';
		  	  $select_color_c=$rs['title_color']=='Red' ? ' selected' : '';
		  	  $select_color_d=$rs['title_color']=='Yellow' ? ' selected' : '';
		  	  $select_color_e=$rs['title_color']=='Pink' ? ' selected' : '';
		  	  $select_color_f=$rs['title_color']=='Green' ? ' selected' : '';
		  	  $select_color_g=$rs['title_color']=='Orange' ? ' selected' : '';
		  	  $select_color_h=$rs['title_color']=='Purple' ? ' selected' : '';
		  	  $select_color_i=$rs['title_color']=='Blue' ? ' selected' : '';
		  	  $select_color_j=$rs['title_color']=='Beige' ? ' selected' : '';
		  	  $select_color_k=$rs['title_color']=='Brown' ? ' selected' : '';
		  	  $select_color_l=$rs['title_color']=='Teal' ? ' selected' : '';
		  	  $select_color_m=$rs['title_color']=='Navy' ? ' selected' : '';
		  	  $select_color_n=$rs['title_color']=='Maroon' ? ' selected' : '';
		  	  $select_color_o=$rs['title_color']=='LimeGreen' ? ' selected' : '';

		  	  $select_extra_a=$rs['title_extra']=='b' ? ' selected' : '';
		  	  $select_extra_b=$rs['title_extra']=='i' ? ' selected' : '';
		  	  $select_extra_c=$rs['title_extra']=='u' ? ' selected' : '';
		} elseif(!empty($_GET['edit']) && $_GET['edit']==='ok') {
			$aid=$_POST['aid'];
			$postdate=$_POST['postdate'];
			$topped=$_POST['topped'];
			$author=$_POST['author'];
			$itfrom=$_POST['itfrom'];
			$subject=$_POST['subject'];
			$title_color=$_POST['title_color'];
			$title_extra=$_POST['title_extra'];
			$content=$_POST['content'];
			$query=query("UPDATE duoxun_news SET postdate='$postdate',topped='$topped',author='$author',itfrom='$itfrom',subject='$subject',title_color='$title_color',title_extra='$title_extra',content='$content' WHERE aid='$aid'");
			if($set['ifhtml']=='1') {
				require_once(R_P.'cache/set.php');
				require_once(R_P.'cache/template.php');
				require_once(R_P.'cache/sort_cache.php');

				!file_exists(R_P.'cache/read_top.php') ? touch(R_P.'cache/read_top.php') : $read_top=readover(R_P.'cache/read_top.php');
				!file_exists(R_P.'cache/read_bottom.php') ? touch(R_P.'cache/read_bottom.php') : $read_bottom=readover(R_P.'cache/read_bottom.php');
				
				$sql="SELECT * FROM duoxun_news WHERE aid='$aid'";
				$rs=get_one($sql);
				$subject=$rs['subject'];
				$href_g=($set['ifhtml']==1 && file_exists(R_P.'news.html')) ? R_P.'news.html' : 'list.php?type=news&id='.$aid;
				$from=$rs['itfrom'];
				$author=$rs['author'];
				$date=getdate($rs['postdate']);
				$date=$date['year'].'/'.$date['mon'].'/'.$date['mday'];
				$hits=$rs['hits'];
				$content=$rs['content'];

				$guide=$subject.' - '.$set['news'].' - ';
				$guidee='<a href="'.$href_g.'">'.$set['news'].'</a>&nbsp;&gt;&nbsp;'.$subject;
				$fenye='';

				ob_start();
				include(R_P.$tplpath.'/readtpl.htm');
				writeover("$aid.html",ob_get_contents(),"rb+",0);
				ob_end_clean();
				chmod("$aid.html",0777);
			}
			if($query) {
				header("Location: job.php?job=news&edit=ok");
			} else {
				echo "<script language=\"javascript\">alert(\"抱歉,由于一些未知原因,文章编辑失败!请重试!\")</script>";
				echo "<meta http-equiv='refresh' content='0;url=admin.php?job=edit&type=news&id=$aid'>";
			}
		} elseif(!empty($_GET['do']) && $_GET['do']==='del') {
			$aid=$_GET['id'];
			$query=query("DELETE FROM duoxun_news WHERE aid=$aid");
			if($set['ifhtml']=='1') {
				@unlink(R_P.$aid.'.html');
			}
			if($query) {
				header("Location: job.php?job=news&del=ok");
			} else {
				echo "<script language=\"javascript\">alert(\"抱歉,由于一些未知原因,文章删除失败!请重试!\")</script>";
				echo "<meta http-equiv='refresh' content='0;url={$_COOKIE['u']}'>";
			}
		}
	} elseif($_GET['type']=='members') {
		if(!empty($_GET['do'])) {
			if($_GET['do']=='edit') {
				$uid=$_GET['uid'];
				$rs=get_one("SELECT * FROM duoxun_members WHERE uid=$uid");
				
				$select_groupid_a=$rs['groupid']==0 ? ' selected' : '';
				$select_groupid_b=$rs['groupid']==1 ? ' selected' : '';

				$select_gender_a=$rs['gender']==3 ? ' selected' : '';
				$select_gender_b=$rs['gender']==1 ? ' selected' : '';
				$select_gender_c=$rs['gender']==2 ? ' selected' : '';

				$bday=explode('-',$rs['bday']);
				$year=$bday[0];
				$mon=$bday[1];
				$mday=$bday[2];
			}
		}	
	}
} elseif(empty($_GET['type'])) {
	if(!empty($_GET['do'])) {
		if($_GET['do']=='edit') {
			$aid=$_GET['id'];
			$subject=get_one("SELECT * FROM duoxun_subject WHERE aid=$aid");
			$sortdb=get_one("SELECT * FROM duoxun_sort WHERE sid={$subject['sid']}");
		  	  $checked_aa=$subject['ifshow']==1 ? ' checked' : '';
		  	  $checked_ab=$subject['ifshow']==1 ? '' : ' checked';
		  	  $checked_ba=$subject['ifcommect']==1 ? ' checked' : '';
		  	  $checked_bb=$subject['ifcommect']==1 ? '' : ' checked';
		  	  $checked_ca=$subject['commect_check']==1 ? ' checked' : '';
		  	  $checked_cb=$subject['commect_check']==1 ? '' : ' checked';

		  	  $select_color_a=$subject['title_color']=='White' ? ' selected' : '';
		  	  $select_color_b=$subject['title_color']=='Black' ? ' selected' : '';
		  	  $select_color_c=$subject['title_color']=='Red' ? ' selected' : '';
		 	  $select_color_d=$subject['title_color']=='Yellow' ? ' selected' : '';
		  	  $select_color_e=$subject['title_color']=='Pink' ? ' selected' : '';
		  	  $select_color_f=$subject['title_color']=='Green' ? ' selected' : '';
		  	  $select_color_g=$subject['title_color']=='Orange' ? ' selected' : '';
		  	  $select_color_h=$subject['title_color']=='Purple' ? ' selected' : '';
		  	  $select_color_i=$subject['title_color']=='Blue' ? ' selected' : '';
		  	  $select_color_j=$subject['title_color']=='Beige' ? ' selected' : '';
		  	  $select_color_k=$subject['title_color']=='Brown' ? ' selected' : '';
		  	  $select_color_l=$subject['title_color']=='Teal' ? ' selected' : '';
		  	  $select_color_m=$subject['title_color']=='Navy' ? ' selected' : '';
		  	  $select_color_n=$subject['title_color']=='Maroon' ? ' selected' : '';
		  	  $select_color_o=$subject['title_color']=='LimeGreen' ? ' selected' : '';

		  	  $select_extra_a=$subject['title_extra']=='b' ? ' selected' : '';
		  	  $select_extra_b=$subject['title_extra']=='i' ? ' selected' : '';
		  	  $select_extra_c=$subject['title_extra']=='u' ? ' selected' : '';
			$query=query("SELECT * FROM duoxun_content WHERE aid=$aid");
			while($rs=fetch_array($query)) {
				$content[]=$rs;
			}
			$p_a=!empty($content) ? count($content) : 0;
			if(!empty($content)) {
				foreach($content as $value) {
					$pids[]=$value['pid'];
				}
				$p_c=max($pids)+1;
			} else {
				$p_c=1;
			}

			$pid=empty($_GET['pid']) ? 1 : $_GET['pid'];

			$query=query("SELECT * FROM duoxun_content WHERE aid=$aid AND pid<=$pid");
			while($rs=fetch_array($query)) {
				$piddb[]=$rs;
			}
			$p_b=!empty($piddb) ? count($piddb) : 0;
			$key=$p_b-1;
		}
	}
}

require_once template('edit','admin');

?>

⌨️ 快捷键说明

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