Advertisement
Guest User

Untitled

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