<?php
include('class/Database.php');
$object = new Database;

if(isset($_POST["username"])) {
	sleep(2);
	$object->query = "SELECT * FROM akun_user WHERE username='".$_POST['username']."' AND password='".$_POST['password']."' ";
	$result = $object->get_result();
	if ($result->rowCount() > 0) {
		//
		foreach($result as $row)
		{
			//echo '<script>alert( "Form successful submitted! '.$_POST["username"].' '.$_POST["password"].' ");</script>';
			$_SESSION['id_akun'] = $row["id_user"];
			if(isset($_SESSION['id_akun'])) header("location:".$object->base_url."form_surat_keluar.php");
		}
		//$_SESSION['id_akun'] = 
		//echo '<script>alert( "Form successful submitted! '.$_POST["username"].' '.$_POST["password"].' ");</script>';
	}
	else{
		//echo '<script>alert( "Username dan Password tidak ditemukan");</script>';
		header("location:".$object->base_url."index.php");
	}
}

?>