Upload New File

parent 6ebd7f11
<?php
session_start();
include('../config.php');
include("template/header.php");
include("../common/function.php");
include("functions.php");
// include("../common/dbconfig.php");
open_page("Tiket");
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 pmt_tiket.id_pemesanan, destinasi.nama_destinasi, pt_trans.nama_transp, t_tiketsdia.harga, t_tiketsdia.kode_tiket, pmt_tiket.via_pembayaran, pmt_tiket.akun_id, pmt_tiket.j_pemesanan
FROM ((pt_kategori INNER JOIN pt_trans ON pt_kategori.id_kategori = pt_trans.kategori_id) INNER JOIN (destinasi INNER JOIN t_tiketsdia ON destinasi.id_destinasi = t_tiketsdia.t_destinasi) ON pt_trans.id_transp = t_tiketsdia.t_kendaraan) INNER JOIN (log_akun INNER JOIN pmt_tiket ON log_akun.id_akun = pmt_tiket.akun_id) ON t_tiketsdia.ID = pmt_tiket.tiket_id
WHERE akun_id = $id_akun;
");
if(isset($_POST["bayar"]))
{
if(bayar($_POST) > 0)
{
echo
"
<script>
alert('Berhasil dibayar');
document.location.href = 'bayar_tiket_user.php';
</script>
";
}else{
echo
"
<script>
alert('Gagal dibayar');
document.location.href = 'p_tiket_user.php';
</script>
";
}
}
?>
<!-- ======= Breadcrumbs ======= -->
<section id="breadcrumbs" class="breadcrumbs">
<div class="container">
<div class="d-flex justify-content-between align-items-center">
<h2>Daftar Tiket Pesan</h2>
</div>
</div>
</section>
<!-- End Breadcrumbs -->
<!-- Start form search -->
<div class="container mt-2 ml-2">
<form action="" method="post">
<table class="table table-bordered mt-3 mb-2">
<thead class="thead-dark">
<tr align="center">
<th scope="col">Kode Tiket</th>
<th scope="col">Tujuan Destinasi</th>
<th scope="col">Harga Tiket</th>
<th scope="col">Jumlah Tiket</th>
<th scope="col">Via Pembayaran</th>
<th scope="col" colspan="2">Tindakan</th>
</tr>
</thead>
<?php
foreach($data as $list_tiket) { ?>
<tr>
<td>
<input type="hidden" name="id_ptiket" value="<?=$list_tiket['id_pemesanan']?>">
<?=$list_tiket['kode_tiket']?></td>
<td><?=$list_tiket['nama_destinasi']?></td>
<td><?=$list_tiket['harga']?></td>
<td><?=$list_tiket['j_pemesanan']?></td>
<td><?=$list_tiket['via_pembayaran']?></td>
<td>
<button class="btn btn-primary mb-3" type="submit" name="bayar">Bayar</button>
</td>
<td>
<a href="hapuspemesanan.php?id_pemesanan=<?= $list_tiket['id_pemesanan'];?>" onclick="return confirm('Apakah Anda sudah yakin ?');" class="btn btn-danger">Batalkan</a>
</td>
</tr>
<?php } ?>
</table>
</form>
</div>
<!-- End form search -->
<?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