PHP和MySql中的新闻项目
应用介绍
此项目是PHP和MySql中的新闻项目;同时分为两个模块:用户模块和管理模块。用户模块是任何人都可以阅读新闻,也可以搜索特定新闻; 读者可以对特定新闻发表评论。管理模块有:安全的管理员登录系统、管理控制台、类别–在此部分中,管理员可以添加/更新/删除类别; 管理员还可以恢复已删除的类别、子类别–在此部分中,管理员可以添加/更新/删除子类别; 管理员还可以还原已删除的子类别、发布-管理员可以添加/更新/删除新闻发布, 管理员还可以在“垃圾邮件”部分中查看已删除的新闻帖子,并还原已删除的帖子、页面–管理员可以管理关于我们的联系人并与我们联系页面、评论–管理员可以批准/取消/删除读者评论。从下面几点告诉我们如何运行NewsPortal Project:1.下载压缩文件。2.解压缩文件并复制newsportal文件夹。3.粘贴到根目录中(对于xampp xam / htdocs,对于wamp wamp / www,对于灯var / www / html)。4.打开phpmyadmin(http:// localhost / phpmyadmin)。5.创建一个名称为newsportal的数据库。6.导入newsportal.sql文件(在sql文件夹的zip包内提供)。7,运行脚本http:// localhost / newsportal(前端)。8.对于管理面板http:// localhost / newsportal / admin。本人只展示了一小段的代码,如想了解更详细请下载附件。
<?php
session_start();
include('includes/config.php');
error_reporting(0);
if(strlen($_SESSION['login'])==0)
{
header('location:index.php');
}
else{
if(isset($_POST['submit']))
{
$category=$_POST['category'];
$description=$_POST['description'];
$status=1;
$query=mysqli_query($con,"insert into tblcategory(CategoryName,Description,Is_Active) values('$category','$description','$status')");
if($query)
{
$msg="Category created ";
}
else{
$error="Something went wrong . Please try again.";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Newsportal | Add Category</title>
<!-- App css -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="assets/css/core.css" rel="stylesheet" type="text/css" />
<link href="assets/css/components.css" rel="stylesheet" type="text/css" />
<link href="assets/css/icons.css" rel="stylesheet" type="text/css" />
<link href="assets/css/pages.css" rel="stylesheet" type="text/css" />
<link href="assets/css/menu.css" rel="stylesheet" type="text/css" />
<link href="assets/css/responsive.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="../plugins/switchery/switchery.min.css">
<script src="assets/js/modernizr.min.js"></script>
</head>
<body class="fixed-left">
<!-- Begin page -->
<div id="wrapper">
<!-- Top Bar Start -->
<?php include('includes/topheader.php');?>
<!-- Top Bar End -->
<!-- ========== Left Sidebar Start ========== -->
<?php include('includes/leftsidebar.php');?>
<!-- Left Sidebar End -->
<div class="content-page">
<!-- Start content -->
<div class="content">
<div class="container">
<div class="row">
<div class="col-xs-12">
<div class="page-title-box">
<h4 class="page-title">Add Category</h4>
<ol class="breadcrumb p-0 m-0">
<li>
<a href="#">Admin</a>
</li>
<li>
<a href="#">Category </a>
</li>
<li class="active">
Add Category
</li>
</ol>
<div class="clearfix"></div>
</div>
</div>
</div>
<!-- end row -->
<div class="row">
<div class="col-sm-12">
<div class="card-box">
<h4 class="m-t-0 header-title"><b>Add Category </b></h4>
<hr />
<div class="row">
<div class="col-sm-6">
<!---Success Message--->
<?php if($msg){ ?>
<div class="alert alert-success" role="alert">
<strong>Well done!</strong> <?php echo htmlentities($msg);?>
</div>
<?php } ?>
<!---Error Message--->
<?php if($error){ ?>
<div class="alert alert-danger" role="alert">
<strong>Oh snap!</strong> <?php echo htmlentities($error);?></div>
<?php } ?>
</div>
</div>
<div class="row">
<div class="col-md-6">
<form class="form-horizontal" name="category" method="post">
<div class="form-group">
<label class="col-md-2 control-label">Category</label>
<div class="col-md-10">
<input type="text" class="form-control" value="" name="category" required>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label">Category Description</label>
<div class="col-md-10">
<textarea class="form-control" rows="5" name="description" required></textarea>
</div>
</div>
<div class="form-group">
<label class="col-md-2 control-label"> </label>
<div class="col-md-10">
<button type="submit" class="btn btn-custom waves-effect waves-light btn-md" name="submit">
Submit
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<!-- end row -->
</div> <!-- container -->
</div> <!-- content -->
<?php include('includes/footer.php');?>
</div>
</div>
<script>
var resizefunc = [];
</script>
<!-- jQuery -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/detect.js"></script>
<script src="assets/js/fastclick.js"></script>
<script src="assets/js/jquery.blockUI.js"></script>
<script src="assets/js/waves.js"></script>
<script src="assets/js/jquery.slimscroll.js"></script>
<script src="assets/js/jquery.scrollTo.min.js"></script>
<script src="../plugins/switchery/switchery.min.js"></script>
<!-- App js -->
<script src="assets/js/jquery.core.js"></script>
<script src="assets/js/jquery.app.js"></script>
</body>
</html>
<?php } ?>
©版权声明:本文内容由互联网用户自发贡献,版权归原创作者所有,本站不拥有所有权,也不承担相关法律责任。如果您发现本站中有涉嫌抄袭的内容,欢迎发送邮件至: [email protected] 进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。
转载请注明出处: apollocode » PHP和MySql中的新闻项目
文件列表(部分)
名称 | 大小 | 修改日期 |
---|---|---|
Newsportal Project | 0.00 KB | 2018-12-44 |
newsportal | 0.00 KB | 2018-12-00 |
about-us.php | 1.65 KB | 2018-07-48 |
about.html | 8.35 KB | 2018-07-28 |
admin | 0.00 KB | 2018-12-50 |
aboutus.php | 8.08 KB | 2018-06-58 |
add-category.php | 6.67 KB | 2018-06-16 |
add-post.php | 10.03 KB | 2018-08-10 |
add-subcategory.php | 7.79 KB | 2018-06-36 |
assets | 0.00 KB | 2018-12-48 |
css | 0.00 KB | 2018-12-44 |
bootstrap.min.css | 118.36 KB | 2016-07-28 |
bootstrap.min.css.map | 529.49 KB | 2016-07-28 |
components.css | 82.76 KB | 2018-04-00 |
core.css | 16.92 KB | 2016-09-48 |
elements.css | 0.00 KB | 2016-09-48 |
icons.css | 197.33 KB | 2016-09-50 |
menu.css | 11.54 KB | 2016-10-48 |
menu_sm.css | 10.58 KB | 2018-04-44 |
pages.css | 19.00 KB | 2018-04-58 |
responsive.css | 4.14 KB | 2016-09-48 |
typicons.css | 22.10 KB | 2016-09-48 |
variables.css | 0.00 KB | 2016-09-48 |
fonts | 0.00 KB | 2018-12-46 |
fontawesome-webfont.eot | 74.72 KB | 2016-07-46 |
fontawesome-webfont.svg | 382.44 KB | 2016-07-46 |
fontawesome-webfont.ttf | 149.21 KB | 2016-07-46 |
fontawesome-webfont.woff | 88.29 KB | 2016-07-46 |
fontawesome-webfont.woff2 | 70.21 KB | 2016-07-46 |
FontAwesome.otf | 122.06 KB | 2016-07-46 |
glyphicons-halflings-regular.eot | 19.66 KB | 2016-07-02 |
glyphicons-halflings-regular.svg | 106.19 KB | 2016-07-02 |
发表评论 取消回复