Commit 73b99abe by Visgha Olivia

Upload New File

parent aa1f9ffe
<?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