<?php 
	
	/*require_once "clases/Conexion.php";
	$obj= new conectar();
	$conexion=$obj->conexion();

	$sql="SELECT * from usuarios where email='admin'";
	$result=mysqli_query($conexion,$sql);
	$validar=0;
	if(mysqli_num_rows($result) > 0){
		$validar=1;
	}*/
 ?>


<!DOCTYPE html>
<html>
<head>
	<title>Login de usuario</title>
	<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
	<link rel="stylesheet" type="text/css" href="librerias/bootstrap/css/bootstrap.css">
	<link rel="shortcut icon" href="img/hardmant3.ico">
	<script src="librerias/jquery-3.2.1.min.js"></script>
	<script src="js/funciones.js"></script>
</head>
<body style="background-color: gray">
	<br><br><br>
	<div class="container">
		<div class="row">
			<div class="col-sm-4"></div>
			<div class="col-sm-4">
            <!--                                                 -->
			<?php
			     
                if (isset($_REQUEST['login'])) {
                    session_start();
                    $user = $_REQUEST['user'] ?? '';
                    $pass = $_REQUEST['pass'] ?? '';
                    include_once "db_empresa.php";
                    $conexion = mysqli_connect($db_host, $db_user, $db_pass, $db_database);
                    $sql = "SELECT id,user,pass from usuarios where user='$user' and pass='$pass'; ";
                    $resultSet = mysqli_query($conexion, $sql);
                    $row = mysqli_fetch_assoc($resultSet);
                    if ($row) {
                        $_SESSION['id'] = $row['id'];
                        $_SESSION['user'] = $row['user'];
                        $_SESSION['activo'] = '1';
						header("Location: menu.php");
						
                    } else {
                ?>
                        <div class="alert alert-danger" role="alert">
                            <img src="img/no-no.gif" width="150px"><strong>Ha,Ha,Ha tu no Ingresas Gorditooooo!!!</strong>
                        </div>
                <?php
                    }
                }
                ?>



   


            <!--                                                 -->
				<div class="panel panel-primary">
					<div class="panel panel-heading"><center>Sistema de ingreso de datos - Hardmant</center></div>
					<div class="panel panel-body">
						<p>
							<center><img src="img/hardmant3.jpg"  height="190"></center>
						</p>
						<form method="post">
							<label>Usuario</label>
							<input type="text" class="form-control input-sm" name="user" id="user">
							<label>Password</label>
							<input type="password" name="pass" id="pass" class="form-control input-sm">
							<p></p>
							<button type="submit" class="btn btn-primary" name="login">Login</button>
							<!--<span class="btn btn-primary btn-sm" id="entrarSistema" name="login" type="submit">Entrar</span> -->
							<!--<?php  if(!$validar): ?>-->
							<!--<a href="registro.php" class="btn btn-danger btn-sm">Registrar</a>-->
							<?php endif; ?>
						</form>
					</div>
				</div>
			</div>
			<div class="col-sm-4"></div>
		</div>
	</div>
</body>
</html>

