<?php
// ========================== 文件说明 ==========================//
// 本文件说明:文章管理
// -------------------------------------------------------------//
// Copyright (C) Security Angel Team All Rights Reserved.
// =============================================================//
error_reporting(7);
// 加载后台函数集合
require "global.php";
//添加文章操作
if($_POST['action'] == "addarticle")
{
//验证逻辑性
$result=checksubject($title);
$result.=checkauthor($author);
$result.=choosesort($sortid);
$result.=checksource($source);
$result.=checkcontent($content);
if($result)
{
sa_exit($result, "javascript:history.go(-1);");
}
$query="SELECT * FROM ".$db_prefix."article WHERE title='".addslashes($_POST['title'])."' and author='".addslashes($_POST['author'])."' and content='".addslashes($_POST['content'])."'";
$result=$DB->num_rows($DB->query($query));
if($result > 0)
{
sa_exit("该文章已存在!", "./article.php?action=add");
}
//验证逻辑性结束
$query="INSERT INTO ".$db_prefix."article (sortid, title, author, source, addtime, kind, hits, content, isparseurl, visible) VALUES ('".intval($_POST['sortid'])."', '".addslashes($_POST['title'])."', '".addslashes($_POST['author'])."', '".addslashes($_POST['source'])."', '".time()."', '".addslashes($_POST['kind'])."', '".intval($_POST['hits'])."', '".addslashes($_POST['content'])."', '".intval($_POST['isparseurl'])."', '".intval($_POST['visible'])."')";
$DB->query($query) or die("添加文章失败!");
redirect("添加文章成功!", "./article.php?action=add");
}
//修改文章操作
if($_POST['action'] == "modarticle")
{
//验证逻辑性
$result=checksubject($title);
$result.=checkauthor($author);
$result.=choosesort($sortid);
$result.=checksource($source);
$result.=checkcontent($content);
if($result)
{
sa_exit($result, "javascript:history.go(-1);");
}
//验证逻辑性结束
$query="UPDATE ".$db_prefix."article SET sortid='".intval($_POST['sortid'])."', title='".addslashes($_POST['title'])."', author='".addslashes($_POST['author'])."', source='".addslashes($_POST['source'])."', kind='".addslashes($_POST['kind'])."', content='".addslashes($_POST['content'])."', isparseurl='".intval($_POST['isparseurl'])."', visible='".intval($_POST['visible'])."' WHERE articleid='".intval($articleid)."'";
$DB->query($query) or die("修改文章失败!");
redirect("修改文章成功!", "./article.php?action=edit");
}
//删除文章操作
if($_POST['action'] == "delarticle")
{
$query="DELETE FROM ".$db_prefix."article WHERE articleid='".intval($articleid)."'";
$DB->query($query) or die("删除文章失败!");
redirect("删除文章成功!", "./article.php?action=edit");
}
//批量删除文章操作
if($_POST['action'] == "domoredel")
{
//验证逻辑性
if (empty($_POST['article']) OR !is_array($_POST['article'])) {
sa_exit("未选择任何文章!", "javascript:history.go(-1);");
}
//验证逻辑性结束
foreach ($article AS $articleid=>$value) {
$DB->query("DELETE FROM ".$db_prefix."article WHERE articleid='".intval($articleid)."'");
}
redirect("批量删除文章成功!", "./article.php?action=moredel");
}
//操作结束
cpheader();
if ($_GET['action']=="add" OR $_GET['action']=="mod"){
?>
<script language="JavaScript">
function ProcessArticle(){
if(document.form.title.value == ''){
alert('请输入标题.');
document.form.title.focus();
return false;
}
if(document.form.sortid.value == ''){
alert('请选择分类.');
document.form.sortid.focus();
return false;
}
if(document.form.content.value == ''){
alert('请输入内容.');
return false;
}
return true;
}
</script>
<?php
}
if (!isset($_GET['action'])) {
$_GET['action']="add";
}
// 添加文章页面
if ($_GET['action']=="add")
{
echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" width=\"95%\" class=\"tblborder\">\n<tr>\n<td>";
$cpforms->formheader(array('title'=>'添加文章',
'name'=>'form',
'extra'=>"onSubmit=\"return ProcessArticle()\""));
$cpforms->makeinput(array('text'=>'文章标题:',
'size'=>'50',
'maxlength'=>'140',
'name'=>'title'));
$cpforms->makeinput(array('text'=>'文章作者:',
'maxlength'=>'50',
'name'=>'author'));
$cpforms->makeinput(array('text'=>'文章出处:',
'size'=>'50',
'maxlength'=>'120',
'name'=>'source'));
$typeoption = array('原创'=>'原创',
'转载'=>'转载',
'翻译'=>'翻译'
);
$cpforms->makeselect(array('text'=>'文章性质:',
'name'=>'kind',
'option'=>$typeoption
));
echo "<tr class=\"".getrowbg()."\">\n";
echo "<td>选择分类:</td>\n";
echo "<td><select name=\"sortid\">\n";
echo "<option value=\"\" selected>选择分类</option>\n";
$query = "SELECT * FROM ".$db_prefix."sort ORDER BY sortid";
$result = $DB->query($query);
while ($sort=$DB->fetch_array($result))
{
echo "<option value=$sort[sortid]>$sort[sortname]</option>\n";
}
echo "</select>\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr class=\"".getrowbg()."\">\n";
echo "<td>UBB标签:</td>\n";
echo "<td>\n";
include("ubb.php");
echo "</td>\n";
echo "</tr>\n";
$cpforms->maketextarea(array('text'=>'文章内容:',
'cols'=>'75',
'rows'=>'20',
'name'=>'content'));
$cpforms->makeyesno(array('text'=>'是否自动分析URL?',
'name'=>'isparseurl',
'selected'=>1));
$cpforms->makeyesno(array('text'=>'显示?',
'name'=>'visible',
'selected'=>1));
$cpforms->makehidden(array('name'=>'action',
'value'=>'addarticle'));
$cpforms->formfooter();
echo "</td>\n</tr>\n</table>";
}//end add
// 文章列表页面
if ($_GET['action']=="edit") {
if (!empty($sortid))
{
$sortid = intval($_GET['sortid']);
$issort = "WHERE sortid=$sortid";
$sortnamequery = $DB->query("SELECT * FROM ".$db_prefix."sort WHERE sortid=$sortid");
$sortnamerow = $DB->fetch_array($sortnamequery);
$sortname=$sortnamerow['sortname'];
} else {
$sortname="All";
$issort = "";
}
echo "<table width=\"95%\" border=\"0\" align=\"center\" cellspacing=\"0\" cellpadding=\"1\">\n";
echo "<tr>\n";
echo " <td><b>分类列表</b></td>\n";
echo "</tr>\n";
$sortquery = $DB->query("SELECT * FROM ".$db_prefix."sort ORDER BY sortid");
while ($sort=$DB->fetch_array($sortquery))
{
echo "<tr>\n";
echo "<td><li><a href=article.php?action=edit&sortid=".$sort['sortid']."><b>".$sort['sortname']."</b></a></td>\n";
echo "</tr>\n";
}
echo "</table>\n";
echo "<br>\n";
//分类列表结束
echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" align=\"center\" width=\"95%\" class=\"tblborder\">\n<tr>\n<td>\n";
$cpforms->tableheader();
echo "<tr>\n";
echo " <td class=\"tbhead\" colspan=\"6\">\n";
echo " <b><font color=\"#F5D300\">".$sortname."</font></b>\n";
echo " </td>\n";
echo "</tr>\n";
echo "<tr bgcolor=\"#999999\">\n";
echo " <td align=\"center\" width=\"6%\"><b>状态</b></td>\n";
echo " <td width=\"42%\"><b>文章标题</b></td>\n";
echo " <td align=\"center\" width=\"14%\"><b>作者</b></td>\n";
echo " <td align=\"center\" width=\"14%\"><b>分类</b></td>\n";
echo " <td align=\"center\" width=\"12%\"><b>时间</b></td>\n";
echo " <td align=\"center\" width=\"12%\"><b>管理操作</b></td>\n";
echo "</tr>\n";
$page = intval($_GET['page']);
if(!empty($page)) {
$start_limit = ($page - 1) * 30;
} else {
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
收起资源包目录
[新闻文章]安全天使文章发布系统(Sarticle) v1.8_sarticlev1.8.rar (31个子文件)
[新闻文章]安全天使文章发布系统(Sarticle) v1.8_sarticlev1.8
安全天使文章发布系统(Sarticle) v1.8
upgrade
upgrade15.php 3KB
readme.htm 4KB
admin
adminfunctions.php 9KB
cp.css 2KB
class
forms.php 8KB
mysql.php 5KB
template.php 9KB
config.php 446B
user.php 7KB
ubb.php 2KB
configurate.php 3KB
global.php 4KB
database.php 7KB
article.php 16KB
index.php 7KB
log.php 7KB
sort.php 7KB
install.php 11KB
settings.php 501B
show.php 2KB
templates
style.css 965B
showarticle.htm 2KB
list_article.htm 479B
index.htm 4KB
sort.htm 136B
message.htm 844B
search.htm 4KB
index.php 3KB
search.php 4KB
js.php 2KB
functions.php 7KB
共 31 条
- 1
资源评论
CyMylive.
- 粉丝: 6710
- 资源: 3万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功