<? session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!--<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../style.css" media="all" />-->
	<!--[if IE 7]>
	<link rel="stylesheet" type="text/css" href="style-ie.css" />
	<![endif]-->
<title>MANZANILLO - Login</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="../images/LPM ORIGINAL.ico" rel="icon">

<link href="https://fonts.googleapis.com/css?family=Lato:300,400,700&display=swap" rel="stylesheet">

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
	
	<link rel="stylesheet" href="../css_new/style.css">
<? if(!isset($_SESSION)) { session_start();}

include("../comun/conexion3.php");
include("../comun/conex_ver.php");
include("../comun/funciones.php");

$link_impo=con_impo();$link=con_ver(); 
 
if(isset($_GET["logout"]) and $_GET["logout"]=='do') session_destroy();

$mensaje="";

if(isset($_POST["enviar"])){
$active=0;

$noCaptcha = 0;

if($_POST["email"]==""){
		$mensaje=		
		'Por favor complete su  Email registrado.<br>';
		//echo "Completa el nombre de usuario y la contrase&ntilde;a para loguearte.";
}
else{		
		$email=$_POST["email"];
 
	 
		
		 $usuarioQ = mysqli_query($link_impo,"select * from contactos_agentes_aduanales inner join agentes_aduanales on  agentes_aduanales.id=contactos_agentes_aduanales.idaa and agentes_aduanales.registro = 'MANZANILLO' and (email_contacto = '".trim($email)."' or email_contacto = '".trim(strtoupper($email))."' or email_contacto = '".trim(strtolower($email))."')  ");
 
		$cant = mysqli_num_rows($usuarioQ);
		$row = mysqli_fetch_array($usuarioQ);
		
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
					//echo $cant;
					if($cant!=0){ 
					    //----control de usuario activo----------------------------------------------
						/*if($row["activo"]==0) {
							$mensaje.= ' Su usuario no está activo, Ud. puede consultar al administrador sobre la activación de su cuenta'."<br>";
							$active = 0;
						}else{
							$active = 1;
						}
						//---------------------------------------------------------------------------*/
						/*if(strtoupper($_POST["email"])!=strtoupper($row["email_contacto"]) ){
							//echo strtoupper($_POST["email"]).'-----'.strtoupper($row["usuario"]).'-----'.$_POST["password"].'-----'.$row["pass"];
							$mensaje='El Nombre de usuario o la contraseña son incorrectos.<br>';
						}*/
						//if(	$noCaptcha == 0 and $active==1){
					$_SESSION[email]=strtolower($_POST[email]);
					    /*echo '
                                    <script>
                                    document.location="registro_bl.php"
                                    </script>';	*/
					
					}else{
						$mensaje='El Email no se encuentra registrado, por favor solicite su registro <br>';
					}
					
					
					} // sending = 1

} //--------- user or password not empty

?>
	<style type="text/css">
	.modalDialog {
		position: fixed;
		font-family: Arial, Helvetica, sans-serif;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		background: rgba(0,0,0,0.8);
		z-index: 99999;
		opacity:0;
		-webkit-transition: opacity 400ms ease-in;
		-moz-transition: opacity 400ms ease-in;
		transition: opacity 400ms ease-in;
		pointer-events: none;
	}
	.modalDialog:target {
		opacity:1;
		pointer-events: auto;
	}
	.modalDialog > div {
		width: 400px;
		position: relative;
		margin: 10% auto;
		padding: 5px 20px 13px 20px;
		border-radius: 10px;
		background: #fff;
		background: -moz-linear-gradient(#fff, #999);
		background: -webkit-linear-gradient(#fff, #999);
		background: -o-linear-gradient(#fff, #999);
	  -webkit-transition: opacity 400ms ease-in;
	-moz-transition: opacity 400ms ease-in;
	transition: opacity 400ms ease-in;
	}
	.close {
		background: #606061;
		color: #FFFFFF;
		line-height: 25px;
		position: absolute;
		right: -12px;
		text-align: center;
		top: -10px;
		width: 24px;
		text-decoration: none;
		font-weight: bold;
		-webkit-border-radius: 12px;
		-moz-border-radius: 12px;
		border-radius: 12px;
		-moz-box-shadow: 1px 1px 3px #000;
		-webkit-box-shadow: 1px 1px 3px #000;
		box-shadow: 1px 1px 3px #000;
	}
	.close:hover { background: #00d9ff; }
	select { color:#000085; }
	option { color:#000085; background-color:grey; }
	option:hover { color:grey; background-color:#000085; }
	</style>

</head>

<body>

	<section class="ftco-section">
		<div class="container" style="margin-top: -80px; height:380px">
			<div class="row justify-content-center">
				<div class="col-md-6 col-lg-5" style="margin-top:-10px">
					<div class="login-wrap p-4 p-md-5">
		      	<div class="d-flex align-items-center justify-content-center">
		      		<p align="center"><span class="fa"><img src="../images/LPM ORIGINAL.png" width="30%;" height="30%;" /></span></p>
		      	</div>
		      	<div class="d-flex align-items-center justify-content-right">
					<p><span style="color:#000085">LOGIN AGENTES ADUANALES MANZANILLO &raquo;</span>
					<? if(($cant>1)){?>
							  <a id="hmod" name="hmod" href="#openModal">&raquo;</a>
					<? } ?>
					</p>
		      	</div>
		      	<form method="post" action="login_n.php" class="login-form">
				<input class="aa" type="hidden" id='booking' name="booking" size="40" value="<?=$_POST[booking]!='' ? $_POST[booking] : $_GET[booking]?>"/> 
		      		<div class="form-group">
		      			<input type="email" class="form-control rounded-left" placeholder="Email" id='email' name="email" value="<?=$_POST[email]?>" required>
		      		</div>
	            <div class="form-group d-md-flex">
	            	<div class="w-50">
	            		<a style="color:#03F; text-decoration:underline; cursor:pointer" href="mailto:exportacion@lpmzlo.com">Solicitar registro de login</a>
					</div>
	            </div>
	            <div class="form-group d-md-flex">
					<div class="w-70 text-md-right">
						<a style="color:#03F; text-decoration:underline; cursor:pointer" href="MANUAL PARA DOCUMENTAR EN SISTEMA ZLO.pdf">Descargar el manual de uso</a>
					</div>
	            </div>
	            <div class="form-group">
	            	<button type="submit" class="btn btn-primary rounded submit p-3 px-5" name="enviar">Entrar</button>
	            </div>
				<div class="form-group" style="margin-top: -15px">
		            	<span style="color:#900; font-size: 12px;"><? echo $mensaje; ?></span>
		        </div>
	            <div class="form-group d-flex">
      
      <? if($cant!=0){
		  con_impo();
					
					$usuarioQ1 = mysqli_query($link_impo,"select *,agentes_aduanales.registro  from contactos_agentes_aduanales 
					inner join agentes_aduanales on  agentes_aduanales.id=contactos_agentes_aduanales.idaa 
					and (email_contacto = '".trim($email)."' or email_contacto = '".trim(strtoupper($email))."' or email_contacto = '".trim(strtolower($email))."')  ");
		
					if(mysqli_num_rows($usuarioQ1)>1){
	  ?>					
							<script>
								<? if(($cant!=0)){?>
									window.location.href = "#openModal";
								<? } ?>
							</script>
      <?
					}elseif(mysqli_num_rows($usuarioQ)==1){
					    echo '
                                    <script>
                                     document.location="registro_bl.php?booking='.$_POST[booking].'"
                                    </script>';	
					}
	  }
	  ?>
	            </div>
	          </form>
	        </div>
				</div>
			</div>
		</div>
		  <? include("../pie_new2.php");?> 
<!-- Seleccione el perfil con el que desea entrar<br /><br /> -->
<div id="openModal" name="openModal" class="modalDialog">
	<div>
		<a href="#close" title="Close" class="close">X</a>
			<p style="text-align: center">
				<div class="form-group" style="font-family:Verdana, Geneva, sans-serif; font-size:11px;">
				<?		
						while($r8=mysqli_fetch_array($usuarioQ1)){
							$aregistro['MANZANILLO']='https://'.$_SERVER["SERVER_NAME"].'/ZLO/agenteaduanal/registro_bl.php?booking='.$_POST[booking];
							$aregistro['VERACRUZ']='https://'.$_SERVER["SERVER_NAME"].'/VER/agenteaduanal/registro_bl.php?booking='.$_POST[booking];
							$aregistro['ALTAMIRA']='https://'.$_SERVER["SERVER_NAME"].'/ATM/agenteaduanal/registro_bl.php?booking='.$_POST[booking];
						echo '<a style="color:#03F; text-decoration:underline; cursor:pointer" href="'.$aregistro[$r8[registro]].'">'.$r8[registro].'</a><br><br>';
					}
				?>		
				</div>
			</p>
			<p style="text-align: center"><a href="login_n.php" class="btn btn-primary rounded submit p-3 px-5">Salir</a></p>
 
	</div>
</div>
	</section>

  <script src="../js_new/jquery.min.js"></script>
  <script src="../js_new/popper.js"></script>
  <script src="../js_new/bootstrap.min.js"></script>
  <script src="../js_new/main.js"></script>

</body>
</html>  
