Advertisement
Guest User

Untitled

a guest
May 1st, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.78 KB | None | 0 0
  1. <?php
  2. include ("db.php");
  3. session_start();
  4. if (isset($_POST['submit'])) {
  5. $username = mysql_real_escape_string($_POST['usuario']);
  6. $salt = sha1(md5($password));
  7. $password = md5($_POST['password'].$salt);  
  8. $query = mysql_query("SELECT * FROM eladmin WHERE usuario = '$username' AND password = '$password'", $conexion) or die(mysql_error($conexion));
  9. if (mysql_num_rows($query) == 0) {
  10. header("location: ../index.php");
  11. exit;
  12. }
  13. $_SESSION['user'] = $username;
  14. $ip = $_SERVER["REMOTE_ADDR"];
  15. $fecha = date('d/m/Y');
  16. $hora = date('h:i:s', strtotime('-1 hour'));
  17. $usuario = $_SESSION['user'];
  18. $query = mysql_query("INSERT INTO logs (ip,fecha,hora,usuario) VALUES ('$ip','$fecha','$hora','$usuario')", $conexion) or die(mysql_error($conexion));
  19. header("location: ../index.php");
  20. }
  21. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement