Commit f4f36df1 by Roy Junedi Simamora

Penambahan fungsi memesan

parent 424a1f0d
......@@ -25,6 +25,7 @@
}
elseif(isset($_SESSION['user'])){
echo' <li><a href="member_menu.php" ><span class="glyphicon glyphicon-th-list"></span>List Menu</a></li>';
$username = $_SESSION['username'];
}
?>
......@@ -44,7 +45,7 @@
<?php
if(isset($_SESSION['user']) || isset($_SESSION['admin'])){
echo "<li><a href='form_login.php?logout'><span class='glyphicon glyphicon-log-out'></span> Logout</a></li>";
echo "<li><a href='form_login.php?logout'><span class='glyphicon glyphicon-log-out'></span>$username</a></li>";
}
else {
echo '<li><a href="form_login.php"><span class="glyphicon glyphicon-log-in"></span>&nbsp;login</a></li>';
......
......@@ -4,25 +4,48 @@ require 'koneksi.php';
?>
<br/>
<a class="btn btn-primary" href="member_menu.php"><span class="glyphicon glyphicon-chevron-left"></span> Kembali</a>
<hr/>
<h3><span class="glyphicon glyphicon-eye-open"></span> Menu Detail </h3>
<div class="row">
<?php
$id = $_GET['id'];
$id_user = $_GET['id_member'];
$query = mysqli_query($koneksi, "SELECT * FROM menu WHERE id_menu = '$id'");
while($q = mysqli_fetch_array($query)){
?>
<div class="col-md-12">
<div class="billInfo grid_11 alpha">
<form method="post" action="pesan_proses.php?id=<?php echo $id; ?>" id="comment_form">
<div class="col-md-6">
<div align="center">
<img src="picture/<?php echo $q['gambar'] ?>" class="img img-thumbnail" width="300" height="300">
</div>
</div>
<div class="col-md-6">
<table class="table table-hover table-condensed">
<tr>
<td> Nama </td>
<td> <?php echo $q['nama'] ?> </td>
</tr>
<tr>
<td> Harga </td>
<td> Rp. <?php echo number_format($q['harga']) ?>,- </td>
</tr>
<tr>
<td>
<form action="pesan_proses.php?id=<?php echo $id?>" method="post">
<fieldset>
<label for="Jumlah">Jumlah: </label>
<input type="text" tabindex="1" size="22" value="" name="jumlah" class="text" />
<input type="submit" value="Pesan"/>
<label for="jumlah"> Jumlah </label>
<input type="text" tabindex="1" size="22" value="1" name="jumlah">&nbsp;
<input type="submit" value="Masukkan Ke Cart" class="btn btn-success">
</fieldset>
</form>
</td>
</tr>
</table>
<a class="btn btn-primary" href="member_menu.php"><span class="glyphicon glyphicon-chevron-left"></span>Pesan Lagi</a>
<a class="btn btn-warning" href="bayar.php?id=<?php echo $id ?>">Checkout<span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
<?php
}
?>
</div>
<br/>
......
......@@ -2,6 +2,7 @@
require_once(dirname(__FILE__).'/common/header.php');
require_once(dirname(__FILE__).'/cek_login.php');
require_once(dirname(__FILE__).'/fungsi/session.php');
if(isset($_GET['do_login'])){
$login =getUser($_POST['username'],$_POST['password']);
......@@ -9,14 +10,19 @@ if(isset($_GET['do_login'])){
$_SESSION['login_error'] = TRUE;
}else{
$_SESSION['user'] = TRUE;
$row = mysqli_fetch_assoc($resUsr);
$row = mysqli_fetch_assoc($login);
$_SESSION['username'] = $row['username'];
$_SESSION['id_member'] = $row['id_member'];
$_SESSION['user'] = TRUE;
header("location:index.php");
}
$log =getAdmin($_POST['username'],$_POST['password']);
if($log == false){
$_SESSION['login_error'] = TRUE;
}else{
$resAdm = mysqli_fetch_array($log);
set_session('id', $resAdm['id_admin']);
set_session('nama', $resAdm['nama']);
$_SESSION['admin'] = TRUE;
header("location:admin_menu.php");
}
......
......@@ -17,12 +17,15 @@ $start = ($page - 1) * $per_hal;
?>
<br/>
<?php
if(isset($_SESSION['username'])){
$id_member = $_SESSION['id_member'];
}
$menu = mysqli_query($GLOBALS["___mysqli_ston"], "select * from menu limit $start, $per_hal");
while ($b = mysqli_fetch_array($menu)) {
?>
<div class="col-md-3">
<a href="detail.php?id=<?php echo $b['id_menu'];?>" class="btn btn-lg btn-buy">
<a href="detail.php?id=<?php echo $b['id_menu'];?>&id_member=<?php echo $id_member; ?>" class="btn btn-lg btn-buy">
<img src="picture/<?php echo $b['gambar'] ?>" class="img-rounded" width="250" height="250">
<div class="caption">
<h4 style="color: #3c3c3c;"> <?php echo $b['nama']; ?> </h4>
......
<?php
session_start();
include 'koneksi.php';
include 'fungsi/fungsi.php';
include 'fungsi/session.php';
$id = $_GET['id'];
$id_member = get_session('id');
$id_menu = $id;
$member_id = $_SESSION['id_member'];
$menu_id = $id;
$tanggal = date('Y-m-d');
$jumlah = $_POST['jumlah'];
mysqli_query($koneksi, "INSERT INTO pemesanan(member_id, menu_id, tanggal, jumlah,id_pemesanan) VALUES('$id_member','$id_menu','$tanggal','$jumlah','')");
mysqli_query($koneksi, "INSERT INTO pemesanan VALUES('', '$member_id', '$menu_id', '$tanggal', $jumlah)");
header('Location: detail.php?id='. $id .'&id_member='. $member_id);
?>
\ No newline at end of file
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