Commit c50035a2 by Julius Samosir

Coba 1

parents
<!-- Add New -->
<div class="modal fade" id="addnew" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<center><h4 class="modal-title" id="myModalLabel"><strong>Tambahkan Paket Baru</strong></h4></center>
</div>
<div class="modal-body">
<div class="container-fluid">
<form method="POST" action="add_paket_proses.php" enctype="multipart/form-data">
<div class="row form-group">
<div class="col-sm-2">
<label class="control-label" style="position:relative; top:7px;">Nama:</label>
</div>
<div class="col-sm-10">
<input type="text" class="form-control" name="nama">
</div>
</div>
<div class="row form-group">
<div class="col-sm-2">
<label class="control-label" style="position:relative; top:7px;">Deskripsi:</label>
</div>
<div class="col-sm-10">
<input type="text" class="form-control" name="deskripsi">
</div>
</div>
<div class="row form-group">
<div class="col-sm-2">
<label class="control-label" style="position:relative; top:7px;">Tanggal:</label>
</div>
<div class="col-sm-10">
<input type="date" class="form-control" name="tanggal">
</div>
</div>
<div class="row form-group">
<div class="col-sm-2">
<label class="control-label" style="position:relative; top:7px;">Gambar:</label>
</div>
<div class="col-sm-10">
<input type="file" class="form-control" name="gambar">
</div>
</div>
<div class="row form-group">
<div class="col-sm-2">
<label class="control-label" style="position:relative; top:7px;">Harga:</label>
</div>
<div class="col-sm-10">
<input type="text" class="form-control" name="harga">
</div>
</div>
<div class="row form-group">
<div class="col-sm-2">
<label class="control-label" style="position:relative; top:7px;">Kuota:</label>
</div>
<div class="col-sm-10">
<input type="text" class="form-control" name="kuota">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="glyphicon glyphicon-remove"></span> Batal</button>
<button type="submit" name="tambahkan" class="btn btn-info"><span class="glyphicon glyphicon-check"></span> Tambahkan</a>
</form>
</div>
</div>
</div>
</div>
\ No newline at end of file
<?php
require_once 'common/database.php';
if(!isset($_SESSION['logged_in'])){
header('location: index.php');
}
date_default_timezone_set('Asia/Jakarta');
$nama = $_POST['nama'];
$deskripsi = $_POST['deskripsi'];
$tanggal = $_POST['tanggal'];
$harga = $_POST['harga'];
$gambar = $_FILES['gambar']['name'];
$kuota = $_POST['kuota'];
$tmp_file = $_FILES['gambar']['tmp_name'];
$path = "uploads/".$gambar;
if(move_uploaded_file($tmp_file,$path)){
$do = CreatePaket($nama,$deskripsi,$tanggal,$gambar,$harga,$kuota);
if($do < 0){
echo "<script>alert('Paket $nama telah dibuat');
window.location = 'paket.php'</script>";
}
else{
echo "<script>alert('Paket $nama gagal dibuat');
window.location = 'paket#addnew.php'</script>";
}
}
else{
echo "<script>alert('Database is in trouble!');
window.location = 'paket.php'</script>";
}
if($tanggal < date_default_timezone_set('Asia/Jakarta')){
echo "<script>alert('Tanggal tidak boleh yang sudah lewat');
window.location = 'paket#addnew.php'</script>";
}
?>
\ 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