当前位置:网站首页>php开发09 文章模块的删除和文章分类编写
php开发09 文章模块的删除和文章分类编写
2022-06-12 01:43:00 【qq_42307546】
增加文件删除功能在article_list.php
<?php
include_once "init.php";
$result = $conn->query("select * from article");
if ($_GET['action'] == 'del'){
$id = filterstr($_GET['id']);
$conn->query("delete from article where id='$id'");
if($conn->affected_rows>0){
redirect(2,'article_list.php','删除成功');
}
else{
redirect(2,'article_list.php','删除失败');
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="UTF-8"/>
<title>后台管理</title>
<link rel="stylesheet" type="text/css" href="css/common.css"/>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
</head>
<body>
<div class="topbar-wrap white">
<div class="topbar-inner clearfix">
<div class="topbar-logo-wrap clearfix">
<h1 class="topbar-logo none"><a href="index.html" class="navbar-brand">后台管理</a></h1>
<ul class="navbar-list clearfix">
<li><a class="on" href="index.html">首页</a></li>
<li><a href="#" target="_blank">网站首页</a></li>
</ul>
</div>
<div class="top-info-wrap">
<ul class="top-info-list clearfix">
<li><a href="#">管理员</a></li>
<li><a href="#">修改密码</a></li>
<li><a href="#">退出</a></li>
</ul>
</div>
</div>
</div>
<div class="container clearfix">
<div class="sidebar-wrap">
<div class="sidebar-title">
<h1>菜单</h1>
</div>
<div class="sidebar-content">
<ul class="sidebar-list">
<li>
<a href="#"><i class="icon-font"></i>常用操作</a>
<ul class="sub-menu">
<li><a href="design.html"><i class="icon-font"></i>作品管理</a></li>
<li><a href="design.html"><i class="icon-font"></i>博文管理</a></li>
<li><a href="design.html"><i class="icon-font"></i>分类管理</a></li>
<li><a href="design.html"><i class="icon-font"></i>留言管理</a></li>
<li><a href="design.html"><i class="icon-font"></i>评论管理</a></li>
<li><a href="design.html"><i class="icon-font"></i>友情链接</a></li>
<li><a href="design.html"><i class="icon-font"></i>广告管理</a></li>
</ul>
</li>
<li>
<a href="#"><i class="icon-font"></i>系统管理</a>
<ul class="sub-menu">
<li><a href="system.html"><i class="icon-font"></i>系统设置</a></li>
<li><a href="system.html"><i class="icon-font"></i>清理缓存</a></li>
<li><a href="system.html"><i class="icon-font"></i>数据备份</a></li>
<li><a href="system.html"><i class="icon-font"></i>数据还原</a></li>
</ul>
</li>
</ul>
</div>
</div>
<!--/sidebar-->
<div class="main-wrap">
<div class="crumb-wrap">
<div class="crumb-list"><i class="icon-font"></i><a href="index.html">首页</a><span class="crumb-step">></span><span class="crumb-name">作品管理</span></div>
</div>
<div class="result-wrap">
<form name="myform" id="myform" method="post">
<div class="result-title">
<div class="result-list">
<a href="artic_add.php"><i class="icon-font"></i>新增作品</a>
</div>
</div>
<div class="result-content">
<table class="result-tab" width="100%">
<tr>
<th>ID</th>
<th>标题</th>
<th>点击</th>
<th>发布人</th>
<th>分类</th>
<th>更新时间</th>
<th>操作</th>
</tr>
<tr>
<?php
$result = $conn->query("select a.id,a.title,a.n,a.author,a.c_time,b.class_name from article as a,cate as b where a.catid = b.id order by a.id desc");
while($row = $result->fetch_assoc()){
?>
<td><?php echo $row['id'];?></td>
<td title="<?php echo $row['title']; ?>"><a target="_blank" href="article_edit.php?id=<?php echo $row['id'];?>" title="<?php echo $row['title']; ?>"><?php echo $row['title']; ?></a>
</td>
<td><?php echo $row['n'];?></td>
<td><?php echo $row['author']; ?></td>
<td><?php echo $row['class_name']; ?></td>
<td><?php echo date("Y-m-d H:i:s",$row['c_time']); ?></td>
<td>
<a class="link-update" href="article_edit.php?id=<?php echo $row['id'];?>">修改</a>
<a class="link-del" href="javascript:del(<?php echo $row['id'];?>);">删除</a>
</td>
</tr>
<?php }?>
</table>
<div class="list-page"> 2 条 1/1 页</div>
</div>
</form>
</div>
</div>
<!--/main-->
</div>
<script>
function del(id){
if(false==confirm("是否确定删除记录?")) return;
location.href='?action=del&id='+id;
}
</script>
</body>
</html>
在common/function增加一个页面跳转提示
<?php //自定义的函数 过滤gpc防止注入 function filterstr($value){ $value=trim($value); if(!get_magic_quotes_gpc()){ $value = addslashes($value); return $value; } return $value; } function redirect($ms ='', $url='', $text=''){ echo <<边栏推荐
- redis集群(cluster)+哨兵模式+主从(replicas)
- How to access the traifik proxy dashboard using the rancher desktop
- Matlab 基础04 - 冒号Colon operator “:”的使用和复杂应用详析
- Freshman year: learning summary
- Interviewer: do you understand redis' shared object pool?
- 如何让杀毒软件停止屏蔽某个网页?以GDATA为例
- Simulated 100 questions and simulated examination for safety management personnel of metal and nonmetal mines (small open pit quarries) in 2022
- Set up NFT blind box mall system | customized development of NFT mall software
- 【项目实训】微信公众号模板消息推送
- Ce soir - là, j'ai battu mon collègue...
猜你喜欢

What is the digital twin of Yixin Huachen and what is its application value?
![[project training] wechat official account template message push](/img/1f/2fe272e2d2a5e3573299c063e870e5.png)
[project training] wechat official account template message push

A summary of the interface automation test problems most easily encountered

Why should a redis cluster use a reverse proxy? Just read this one

Sogou Pinyin official website screenshot tool pycharm installation

Quatre schémas de mise en file d'attente des messages pour redis

Ce soir - là, j'ai battu mon collègue...

Design practice of rongyun Im on electron platform

Go language learning summary (7) -- Dachang go programming specification summary

Program environment and pretreatment
随机推荐
The 14th five year plan and investment feasibility study report of global and Chinese hydraulic ester base oil industry 2022 ~ 2028
MySQL training report [with source code]
How to buy children's serious illness insurance, what to pay attention to and how to choose products
【项目实训】jwt
Detailed explanation and examples of common parameters of curl
螺旋矩阵(技巧)
西南林业大学“西林链”通过工信部电子标准院功能测试 | FISCO BCOS案例
Prism框架初识-模块化介绍
[project training] wechat official account to obtain user openid
In depth description of Weibull distribution (2) meaning of parameters and formulas
Freshman year: learning summary
[popular science video] what is a lens antenna?
[n32g457] remote monitoring of graffiti cloud based on RT thread and n32g457
Concepts of programs, processes, and threads
Three line code solution - Maximum sub segment and - DP
kmeans从0到1
The road of global evolution of vivo global mall -- multilingual solution
I worked as a software testing engineer in a large factory and wrote "one day's complete workflow"
Research Report on development status and investment suggestions of o-tert-butyl cyclohexyl acetate Market in the world and China 2022-2028
Why should a redis cluster use a reverse proxy? Just read this one