Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require("config_claro.php");
- require("sys_funciones.php");
- $ip = $_SERVER["REMOTE_ADDR"];
- $zone = 3600*-5; //USA
- $hoy = gmdate("Y-m-d h:i:s", time() + $zone);
- $int=0;
- $consul="select * from empleado where (codigo = '$codigo') and (clave = '$clave') and (existe='1')";
- $resul=mysql_query($consul, $con);
- $uid=0;
- $sid=0;
- $activo=0;
- $err=0;
- $tot=0;
- //------------------------------------------------------------------------------
- while($f=mysql_fetch_array($resul))
- {
- $uid = $f["Id"];
- $activo = $f["activo"];
- }
- //------------------------------------------------------------------------------
- if($activo>0)
- {
- if($uid>0)
- {
- $consul="select count(Id) as tot from empleado_tienda where idempleado = '$uid'";
- $resul=mysql_query($consul, $con);
- $f=mysql_fetch_array($resul);
- $tot=$f[0];
- if($tot>0)
- {
- $consul="delete from ip where ipnro = '$ip'";
- $resul=mysql_query($consul, $con);
- $sid = IniciarSesion($uid, $con);
- }
- else
- {
- $err=2; // datos correctos pero no tiene tienda!
- }
- }
- else
- {
- $err=1; // nombre de usuario o contrase�a incorrecta!
- $consul="insert into ip(ipnro,fecha_hora,user,pass) values ('$ip','$hoy','$codigo','$clave')";
- $resul=mysql_query($consul, $con);
- }
- }
- else //del if $activo>0
- {
- if($uid>0)
- {
- $err=3; // existe pero no esta activo!
- }
- else
- {
- $err=1; // nombre de usuario o contrase�a incorrecta!
- $consul="insert into ip(ipnro,fecha_hora,user,pass) values ('$ip','$hoy','$codigo','$clave')";
- $resul=mysql_query($consul, $con);
- }
- }
- $consul="select ipnro,count(*) from ip group by ipnro having ipnro = '$ip'";
- $resul=mysql_query($consul, $con);
- $f=mysql_fetch_array($resul);
- $int=$f[1];
- if($int>2)
- {
- mail('info@sistemaclaro.com', 'Bloqueo IP', $ip);
- mail('alonso1978@gmail.com', 'Bloqueo IP', $ip);
- }
- //------------------------------------------------------------------------------
- if($sid>0)
- {$destino="sys_login2.php?sid=$sid&uid=$uid";}
- else
- {$destino="sys_login.php?err=$err";}
- header("location: $destino");
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement