<?php
require('top.php');

InitGP(array('action','n_title','n_content','id',),'GP',false);
// 频道管理
if ($action == 'n_ins') {
	$sql = "INSERT INTO ".$db_tablepre."notice (n_title,n_content,n_uid,n_uptimes) VALUES ('".$n_title."', '".$n_content."',".$_SESSION['admin_u_id'].",'".$timestamp."')";
	sql_return($sql) && Showmsg('post_Success');

}
elseif ($action == 'm') {
	$sql = "SELECT n_title,n_content FROM ".$db_tablepre."notice WHERE 	n_id=".$id;
	$row= sql_return($sql,2);
	$n_title = $row['n_title'];
	$n_content = $row['n_content'];	
}
elseif ($action == 'n_up') {
	$sql = "UPDATE ".$db_tablepre."notice SET n_title='".$n_title."',n_content='".$n_content."',n_uid='".$_SESSION['admin_u_id']."',n_uptimes='".$timestamp."' WHERE n_id=".$id;
	sql_return($sql) && Showmsg('post_Success');
}

elseif ($action == 'del') {
		$sql = 'DELETE FROM '.$db_tablepre.'notice WHERE n_id='.$id;
		sql_return($sql) && Showmsg('dle_Success');
}

else {
	$sql = "SELECT *,u.u_name_2 FROM ".$db_tablepre."notice n LEFT JOIN ".$db_tablepre."user u ON n.n_uid=u.u_id  order by n_uptimes desc limit 10";
	$query = sql_return($sql);
	
}

require PrintEot($self_template,'A');
?>