Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include ("db.php");
- session_start();
- if (isset($_POST['submit'])) {
- $username = mysql_real_escape_string($_POST['usuario']);
- $salt = sha1(md5($password));
- $password = md5($_POST['password'].$salt);
- $query = mysql_query("SELECT * FROM eladmin WHERE usuario = '$username' AND password = '$password'", $conexion) or die(mysql_error($conexion));
- if (mysql_num_rows($query) == 0) {
- header("location: ../index.php");
- exit;
- }
- $_SESSION['user'] = $username;
- $ip = $_SERVER["REMOTE_ADDR"];
- $fecha = date('d/m/Y');
- $hora = date('h:i:s', strtotime('-1 hour'));
- $usuario = $_SESSION['user'];
- $query = mysql_query("INSERT INTO logs (ip,fecha,hora,usuario) VALUES ('$ip','$fecha','$hora','$usuario')", $conexion) or die(mysql_error($conexion));
- header("location: ../index.php");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement