<?php
	echo "<title>Loading...</title><div id='loading'><div class='loader'></div><br>Loading...</div>";
	date_default_timezone_set('Asia/Jakarta');
	
	if(isset($_GET['id'])){
		$id = (int) $_GET['id'];
		$db = mysqli_query($koneksi, "SELECT * FROM cmas_bus WHERE bus_id='$id'");
		if(mysqli_num_rows($db) > 0 ){
			$dt = mysqli_fetch_array($db);
			
			$bus_id = $dt['bus_id'];
			$bus_nama = mysqli_real_escape_string($koneksi, $dt['bus_nama']);
			$busimg_judul = mysqli_real_escape_string($koneksi, $dt['busimg_judul']);
			
			$updated = date('Y-m-d H:i:s');
			
			$notification_ip = $_SERVER['REMOTE_ADDR'];
			mysqli_query($koneksi, "INSERT INTO cmas_notification (notification_id, notification_status, notification_description, notification_ip, notification_read, postdated, posted_id, posted_username, posted_nama) VALUE(NULL, 'Delete', 'File Header Bus: $bus_nama', '$notification_ip', '1', '$updated', '$udt[admin_id]', '$udt[admin_username]', '$udt[admin_nama]')");
			
			@unlink('assets/images/bus/head/'.$dt['bus_header']);
			mysqli_query($koneksi, "UPDATE cmas_bus SET bus_header='', bus_headerid='0' WHERE bus_id='$id'") or die (mysqli_error($koneksi));
			
			echo "<meta http-equiv='refresh' content='0; url=?m=bushead_edit&id=$bus_id&ds=ds'>";
		}
	}
?>