Delete berita_user.php

parent 435ad9ea
<?php
session_start();
include('../config.php');
include("template/header.php");
include("../common/function.php");
include("functions.php");
open_page("Berita");
if(! isset($_SESSION['is_login']))
{
header('location:../index.php');
}
if (!isset($_SESSION["username"])){
// echo "<script>alert('Login terlebih dahulu');window.location='../index.php';</script>";
// exit;
echo "Anda harus login dulu <br><a href='../index.php'>Klik disini</a>";
exit;
}
$role = $_SESSION["role"];
if($role != "user"){
echo "<script>alert('Anda bukan user');window.location='../index.php';</script>";
exit;
}
$id_akun = $_SESSION["id_akun"];
$nama = $_SESSION["nama"];
$username = $_SESSION["username"];
$data = query("SELECT * FROM b_Berita");
// function sorting
if (isset($_POST["sorting"])){
$data = sorting($_POST["keyword"]);
}
?>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container">
<div class="d-flex justify-content-between align-items-center">
<h2>Berita</h2>
</div>
</div>
</section>
<!-- End Breadcrumbs -->
<!-- Start form search -->
<div class="container mt-2 ml-2">
<form method="post" action="">
<label for="">Sorting Berita </label><br>
<select name="keyword">
<option value="ASC">Terlama</option>
<option value="DESC">Terbaru</option>
</select>
<button type="submit" name="sorting" class="btn btn-sm btn-outline-primary">
<svg class="bi bi-search" width="1em" height="1em" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M10.442 10.442a1 1 0 0 1 1.415 0l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1 1 0 0 1 0-1.415z"/>
<path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>
</svg>
</button>
</form>
</div>
<!-- End form search -->
<!-- Content -->
<div class="ml-3 mr-3">
<?php foreach($data as $berita) { ?>
<div class="card-group mt-2" >
<div class="card mt-3">
<div class="card-header">
<?=$berita["judul_berita"]?>
</div>
<div class="card-body">
<blockquote class="blockquote mb-0">
<p><?=$berita["deskripsi"]?></p>
<img src="<?= BASEURL; ?>public/img/<?= $berita['gambar_berita'] ?>" class="card-img" alt="..." style="width:500px;length:500px;">
<footer class="blockquote-footer">Travel OK <cite title="t_upload"><?=$berita["t_upload"]?></cite></footer>
</blockquote>
</div>
</div>
</div>
<!-- End Content -->
<?php } ?>
</div>
<?php
include("template/footer.php")
?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment