<?php 



if(isset($_POST['submit'])){

	$username=$_POST['username'];
	$password=$_POST['password'];

	if(empty($username) || empty($password)){
		print '<div class="alert alert-danger"> Nombre de Usuario o Contraseña vacio</div>';
		?><meta http-equiv="refresh" content="3; url=login.php" /> <?php 
	}else{
		$limp=new User;
		$userL=$limp->limpiar1($_POST['username']);
		$passL=$limp->limpiar2($_POST['password']);

		$user = new User;
		if($user->getUser($userL,$passL)){
			session_start();
			//$_SESSION['usuario'] = $username;
			header('location: sistem/index.html'); //welcome.php
			?>
			<meta http-equiv="refresh" content="0;url=sistem/index.html">
			<script language="javascript">
		        window.location.href = "sistem/index.html"
		    </script>
		    <?php
		}else{
			print '<div class="alert alert-danger">Usuario no existe </div>';
			?><meta http-equiv="refresh" content="3; url=login.php" /> <?php 
		}
	} 
}
?>