<?php
session_start();
require_once('conn.php');
$key_word = @ $_POST['key_word'];
?>
<html>
<head>
<title>系统后台</title>
<link type="text/css" rel="stylesheet" href="css/backstage.css">
</head>
<body>
<div class="container_bk">
<div class="top_navigation">
<?php
if(@ $_SESSION['user_name'] == "")
{
echo "<script>alert('您还没有登录,请先登录!');history.back();</script>";
exit;
}
else
{
$user_name = $_SESSION['user_name'];
echo "<span>管理员:[$user_name] 欢迎您! <a href='loginout.php'>注销用户</a></span>";
}
?>
</div>
<div class="top_banner">
<span>新闻管理系统后台</span>
</div>
<div class="content_bk">
<div class="content_left">
<div class="news_type">
<table>
<tr>
<th>新闻管理系统后台中心:</th>
</tr>
<tr>
<td><a href="news_add.php">添加新闻</a></td>
</tr>
<tr>
<td><a href="type_add.php">添加新闻分类</a></td>
</tr>
<tr>
<td>分类/管理</td>
</tr>
<?php
$sql2 = mysqli_query($conn,"SELECT * FROM newstype ORDER BY type_id ASC");
while ($info2 = mysqli_fetch_array($sql2))
{
$type_id = $info2['type_id'];
$type_name = $info2['type_name'];
echo "<tr>";
echo "<td>[$type_name] <a href='type_upd.php?type_id=$type_id'>修改</a>
<a href='type_del.php?type_id=$type_id'>删除</a></td>";
echo "</tr>";
}
?>
</table>
</div>
</div>
<div class="content_right">
<form name="form1" method="post" action="admin.php">
<span>查询主题:<input type="text" name="key_word" id="key_word" value="">
<input type="submit" name="news_query" id="news_query" value="查 询"></span>
</form>
<table class="news_list1">
<caption>新闻列表:</caption>
<tr>
<th class="tb_title">标 题</th>
<th class="tb_date">加入时间</th>
<th class="tb_detail">详细内容</th>
</tr>
<?php
$sql1 = mysqli_query($conn,"SELECT COUNT(*) AS total FROM news
WHERE news_title LIKE '%$key_word%'");
$info1 = mysqli_fetch_array($sql1);
$total = $info1['total'];
if($total == 0)
{
echo "本系统暂无任何查询数据。";
exit;
}
else
{
$page_size = 10;
if($total <= $page_size)
{
$page_connt = 1;
}
if(($total % $page_size) != 0)
{
$page_connt = intval($total/$page_size) + 1;
}
else
{
$page_connt = intval($total/$page_size);
}
if((@ $_GET['page']) == "")
{
$page = 1;
}
else
{
$page = intval($_GET['page']);
}
$sql1 = mysqli_query($conn,"SELECT * FROM news WHERE news_title LIKE '%$key_word%'
ORDER BY news_id ASC LIMIT "
.(($page-1)*$page_size).",$page_size");
while($info1 = mysqli_fetch_array($sql1))
{
$news_id = $info1['news_id'];
$news_title = $info1['news_title'];
$news_date = $info1['news_date'];
echo "<tr>";
echo "<td class='tb_l'>$news_title</td>";
echo "<td class='tb_c'>$news_date</td>";
echo "<td class='tb_c'><a href='news_upd.php?news_id=$news_id'>修改</a>
<a href='news_del.php?news_id=$news_id'>删除</a></td>";
echo "</tr>";
}
}
?>
</table>
<table class="page_list1">
<?php
echo "<tr>";
echo "<td>共有数据 $total 条,每页显示 $page_size 条; 第 $page 页/共 $page_connt 页: ";
if($page >= 2)
{
echo "<a href='admin.php?page=1' title='首页'> 首 页 </a>/<a href='admin.php?page="
.($page-1)."' title='前一页'>前一页</a> ";
}
if($page_connt >= 2)
{
for($i=1; $i<=$page_connt; $i++)
{
echo "<a href='admin.php?page=$i'> $i </a>";
}
}
if($page >= 2)
{
echo "<a href='admin.php?page=".(($page+1)>=$page_connt?$page_connt:($page+1)).
"' title='后一页'> 后一页</a>/<a href='admin.php?page=$page_connt' title='尾页'>尾页</a>";
}
echo "</td>";
echo "</tr>";
?>
</table>
</div>
</div>
<div class="footer">
<p>新闻管理系统由modern358@163.com提供,仅供学习,不得用于商业行为,版权所有,违者必究。</p>
</div>
</div>
</body>
</html>
没有合适的资源?快使用搜索试试~ 我知道了~
php新闻管理系统.zip
共28个文件
php:20个
xml:3个
css:2个
需积分: 10 30 下载量 3 浏览量
2019-12-28
23:28:35
上传
评论 8
收藏 144KB ZIP 举报
温馨提示
新闻管理发布系统 分块显示新闻; 搜索新闻; 浏览新闻; 登录功能; 编辑新闻(添加、更新、删除、置顶等) 批量处理
资源推荐
资源详情
资源评论
收起资源包目录
php新闻管理系统.zip (28个子文件)
php新闻管理系统
news
conn.php 350B
chkadmin.php 1KB
savedel.php 294B
type_add.php 2KB
type_upd.php 3KB
admin_login.php 1KB
type.php 5KB
news_del.php 4KB
images
banner3.jpg 116KB
type_add_save.php 309B
news_add.php 4KB
.idea
misc.xml 174B
news.iml 281B
workspace.xml 35KB
inspectionProfiles
modules.xml 260B
type_del_save.php 300B
saveadd.php 564B
loginout.php 179B
type_del.php 2KB
admin.php 6KB
index.php 6KB
newscontent.php 2KB
data
news.sql 4KB
css
backstage.css 6KB
style.css 6KB
type_upd_save.php 359B
news_upd.php 5KB
saveupdate.php 613B
共 28 条
- 1
资源评论
李璟瑜呐
- 粉丝: 10
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功