Guest User

Untitled

a guest
Jan 14th, 2019
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. <?php
  2. include("shortcuts/header.php");
  3. include("shortcuts/functions.php");
  4. $ip = $_SERVER['REMOTE_ADDR'];
  5. ?>
  6. <title>Registering - LegionPvP Forums</title>
  7. <div style="float:center"><div class="span7">
  8. <div class="hero-unit" style="padding: 7px;-webkit-border-radius: 12px;-moz-border-radius: 12px;border-radius: 12px;">
  9. <?php
  10. $logged = true;
  11. if(isset($_POST['login'])){
  12. $total = mysql_query("select * from login_attempts where ip = '".$ip."'");
  13. if(mysql_num_rows($total) >= 5){
  14. echo 'You have exceeded your login attempts.';
  15. }else{
  16. $grabuser = mysql_query("select * from users where username = '".$_POST['username']."'");
  17. if(empty($_POST['username']) || empty($_POST['password']))
  18. echo 'Please fill in both the username/password.';
  19. elseif(mysql_num_rows($grabuser) == 0){
  20. echo 'User doesn\'t exist';
  21. }else{
  22. $info = mysql_fetch_assoc($grabuser);
  23. $username = $info['username'];
  24. $password = $info['password'];
  25. if($password != (md5($_POST['password']))){
  26. echo 'Password is incorrect';
  27. $insert = mysql_query("insert into login_attempts (ip, time) VALUES ('".$ip."', '".time()."')");
  28. }else{
  29. $_SESSION['username'] = $username;
  30. header("Location: index.php");
  31. $logged = false;
  32. }
  33. }
  34. }
  35. }
  36. ?>
Add Comment
Please, Sign In to add comment