<?php 
include '../koneksi.php';
session_start();
date_default_timezone_set('Asia/Jakarta');

$waktu = date('Y-m-d H:i:s'); 
$petugas = $_SESSION['id'];
$nomor_surat  = $_POST['nomor_surat'];
$tgl_surat  = $_POST['tgl_surat'];
$jml_monev  = $_POST['jml_monev'];

$rand = rand();

$filename = $_FILES['file']['name'];
$jenis = pathinfo($filename, PATHINFO_EXTENSION);


if($jenis == "php") {
	header("location:undangan.php?alert=gagal");
}else{
	move_uploaded_file($_FILES['file']['tmp_name'], '../arsipmonev/'.$rand.'_'.$filename);
	$nama_file = $rand.'_'.$filename;
	mysqli_query($koneksi, "insert into undangan values (NULL,'$nomor_surat','$tgl_surat','$jml_monev','NULL','$nama_file')")or die(mysqli_error($koneksi));
	header("location:undangan.php?alert=sukses");
}
