Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. takelogin.php
  2.  
  3. <?php
  4. require_once("include/bittorrent.php");
  5.  
  6. if (!mkglobal("username:password"))
  7.     die();
  8.  
  9. dbconn();
  10.  
  11. function bark($text = "Username or password incorrect <a href=recover.php>Recover your password</a>")
  12. {
  13. stderr("Login failed!", $text);
  14. }
  15.  
  16. $res = mysql_query("SELECT id, passhash, secret, enabled FROM users WHERE username = " . sqlesc($username) . " AND status = 'confirmed'");
  17. $row = mysql_fetch_array($res);
  18.  
  19.  
  20. if (!$row)
  21.     bark();
  22.  
  23. if ($row["passhash"] != md5($row["secret"] . $password . $row["secret"]))
  24.     bark();
  25.    
  26. if ($row["enabled"] == "no")
  27.     bark("This account has been disabled.");
  28.  
  29. logincookie($row["id"], $row["passhash"]);
  30.  
  31. if (!empty($_POST["returnto"]))
  32.     header("Location: $BASEURL$_POST[returnto]");
  33. else
  34.     header("Location: $BASEURL/my.php");
  35.  
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement