<?php
	session_start();
	include_once"includes/conn.php";
	include_once"functions/Error.php";

	if (isset($_POST['Login'])) {
		$username = mysqli_real_escape_string($conn,strip_tags($_POST['uname']));
		$password = mysqli_real_escape_string($conn,strip_tags($_POST['pword']));

		if (empty($username) || empty($password)) {
			$_SESSION['er'] = 'emp';
			header('Location: ../HN/index.php');
		}else{
			$sql = "SELECT * FROM users WHERE  Username = '$username' AND Password = '$password' ";
		$result = mysqli_query($conn,$sql);
		if (mysqli_num_rows($result)>0) {
			while ($rows = mysqli_fetch_assoc($result)) {
							$_SESSION['id'] = 'Admin';
							header('Location: ../Add-Shipment.php');
						}	
		}else{
			$_SESSION['er'] = 'inv';
			header('Location: ../HN/index.php');
		}
	}
		
	}

?>