php 文章管理(6)
来源:未知 责任编辑:责任编辑 发表时间:2015-10-08 14:15 点击:次
}else {
$tpl->assign('no_recommend','checked');
}
$tpl->assign('fck',$oFCKeditor->Create());
$tpl->assign("act","update");
$tpl->assign('submitButton','修改');
$tpl->display('admin/addArticle.tpl');
}elseif ($_REQUEST['action']=='update'){
$id=$_POST['id'];
$title=$_POST['title'];
$zhaiyao=$_POST['zhaiyao'];
$author=$_POST['author'];
$laiyuan=$_POST['laiyuan'];
$keyword=$_POST['keyword'];
$is_tuijian=$_POST['is_tuijian'];
$content=$_POST['content'];
$sql="update article set title='$title',zhaiyao='$zhaiyao',author='$author',laiyuan='$laiyuan',keyword='$keyword',is_tuijian='$is_tuijian',
content='$content' where id ='$id'";
$rs=$db->query($sql);
if($rs){
echo header("location:/admin/article.php?action=list");
}else {
echo "修改失败!";
}
}
/*删除*/
elseif ($_REQUEST['action']=='del'){
$id=$_GET['id'];
del($id);
}
/*审核文章*/
elseif ($_REQUEST['action']=='shenhe'){
$id=$_GET['id'];
shenhe($id);
}
/*锁定文章*/
elseif ($_REQUEST['action']=='lock'){
$id=$_GET['id'];
lock($id);
}
/*批量删除*/
/*批量审核*/
elseif (isset($_REQUEST['shenhe_x'])||isset($_REQUEST['shenhe_y'])){
$del=$_POST['del'];
shenhe($del);
}
/*批量锁定*/
elseif (isset($_REQUEST['lock_x'])||isset($_REQUEST['lock_y'])){
$del=$_POST['del'];
lock($del);
}
/*=======文章模块相关函数==========*/
/**
* 获取所有的文章进行分页用
* */
function getAllArticle(){
global $db;
$sql="select * from article";
$rs=$db->query($sql);
$total=$db->num_rows($rs);
return $total;
}
/*文章分页相关函数*/
function getArticlePage($offset,$num){
global $db;
$sql="select*from article order by id desc limit $offset,$num";
$rs=$db->query($sql);
while ($row=$db->fetch_array($rs)){
$data[]=$row;
}
return $data;
}
/*文章修改*/
function editArticle($id){
global $db;
$sql="select * from article where id = '$id'";
$rs=$db->query($sql);
return $row=$db->fetch_array($rs,MYSQL_ASSOC);
相关新闻>>
- 发表评论
-
- 最新评论 更多>>