Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PSW_II_PARIWISATA_TRANSPORTASI
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Proyek_PSW_II_PARIWISATA
PSW_II_PARIWISATA_TRANSPORTASI
Commits
2da78b68
Commit
2da78b68
authored
Jun 06, 2020
by
11319009_Pratiwi Sibarani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
4e404c2b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
143 additions
and
0 deletions
+143
-0
berita_admin.php
transportasi/admin/berita_admin.php
+143
-0
No files found.
transportasi/admin/berita_admin.php
0 → 100644
View file @
2da78b68
<?php
session_start
();
include
(
'../config.php'
);
include
(
'function.php'
);
// include("../common/dbconfig.php");
include
(
"template/header.php"
);
include
(
"../common/function.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
!=
"admin"
){
echo
"<script>alert('Anda bukan admin');window.location='../index.php';</script>"
;
exit
;
}
$id_akun
=
$_SESSION
[
"id_akun"
];
$nama
=
$_SESSION
[
"nama"
];
$username
=
$_SESSION
[
"username"
];
$query
=
"SELECT * FROM b_berita"
;
$data
=
mysqli_query
(
$koneksi
,
$query
);
if
(
isset
(
$_POST
[
"tambah"
]))
{
if
(
tambahberita
(
$_POST
)
>
0
)
{
echo
"
<script>
alert('Berhasil ditambahkan');
document.location.href = 'berita_admin.php';
</script>
"
;
}
else
{
echo
"
<script>
alert('Gagal ditambahkan');
document.location.href = 'berita_admin.php';
</script>
"
;
}
}
?>
<!-- ======= 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 -->
<div
class=
"container"
>
<button
type=
"button"
class=
"btn btn-primary mt-3"
data-toggle=
"modal"
data-target=
"#exampleModal"
>
Tambah Data
</button>
<table
class=
"table table-bordered mt-3 mb-2"
>
<thead
class=
"thead-dark"
>
<tr
align=
"center"
>
<th
scope=
"col"
rowspan=
"2"
>
Judul Berita
</th>
<th
scope=
"col"
rowspan=
"2"
>
Deskripsi
</th>
<th
scope=
"col"
rowspan=
"2"
>
Gambar
</th>
<th
scope=
"col"
>
Option
</th>
</tr>
</thead>
<?php
while
(
$berita
=
mysqli_fetch_array
(
$data
))
{
?>
<tr>
<td
align=
"center"
>
<?=
$berita
[
'judul_berita'
]
?>
</td>
<td>
<?=
$berita
[
'deskripsi'
]
?>
</td>
<td
align=
"center"
><img
src=
"
<?=
BASEURL
;
?>
public/img/
<?=
$berita
[
'gambar_berita'
]
?>
"
class=
"align-self-center"
alt=
"gambar_destinasi"
style=
"width:150px;length:150px"
></td>
<td>
<a
href=
"ubahberita.php?id_berita=
<?=
$berita
[
'id_berita'
];
?>
"
class=
"badge badge-success"
>
Ubah
</a>
<a
href=
"hapusberita.php?id_berita=
<?=
$berita
[
'id_berita'
];
?>
"
onclick=
"return confirm('Apakah Anda sudah yakin ?');"
class=
"badge badge-danger"
>
Hapus
</a>
</td>
</tr>
<?php
}
?>
</table>
<!-- Modal tambah-->
<div
class=
"modal fade"
id=
"exampleModal"
tabindex=
"-1"
role=
"dialog"
aria-labelledby=
"exampleModalLabel"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
role=
"document"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h2>
Tambah Berita
</h2>
<button
type=
"button"
class=
"close"
data-dismiss=
"modal"
aria-label=
"Close"
>
<span
aria-hidden=
"true"
>
×
</span>
</button>
</div>
<div
class=
"modal-body"
>
<div
class=
"container"
>
<form
action=
""
method=
"POST"
enctype=
"multipart/form-data"
>
</div>
<form>
<div
class=
"form-group"
>
<label
for=
"judul_berita"
>
Judul Berita
</label>
<input
autocomplete=
"off"
type=
"text"
name=
"judul_berita"
class=
"form-control"
placeholder=
"Masukkan nama destinasi"
>
</div>
<div
class=
"form-group"
>
<label
for=
"deskripsi"
>
Deskripsi Berita
</label>
<input
autocomplete=
"off"
type=
"text"
name=
"deskripsi"
class=
"form-control"
placeholder=
"Masukkan nama destinasi"
>
</div>
<div
class=
"form-group"
>
<label
for=
"gambar_berita"
>
Gambar Berita
</label>
<input
autocomplete=
"off"
type=
"file"
class=
"form-control"
name=
"gambar_berita"
>
</div>
<input
type=
"hidden"
name=
"t_upload"
>
<button
type=
"submit"
class=
"btn btn-primary"
name=
"tambah"
>
Tambah
</button>
</form>
</div>
</div>
</div>
</div>
<!-- End Modal tambah-->
</div>
<?php
include
(
"template/footer.php"
)
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment