<?php
	session_start();

	if (isset($_POST)) {
			
	//Contiene las variables de configuracion para conectar a la base de datos
	include "../config/config.php";
	
	//init_set('session.cookie_lifetime',time()+(60*60*3));
	
	//limpieza de variables recibidas en el login
    $user = substr($_POST["email"],0,4);
    $pass = substr($_POST["password"],0,4);
    
	$email=mysqli_real_escape_string($con,(strip_tags($user,ENT_QUOTES)));
	$password=sha1(md5(mysqli_real_escape_string($con,(strip_tags($pass,ENT_QUOTES)))));

    $query = mysqli_query($con,"SELECT * FROM user WHERE email =\"$email\" OR username=\"$email\" AND password = \"$password\";");

		if ($row = mysqli_fetch_array($query)) {
			

				$_SESSION['admin_id'] = $row['id'];
				header("location: ../mistickets.php");
				

		}else{
			header("Location: ../index.php?alert=1");
		}
	}else{
		header("location: ../");
	}

?>