Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <?php
  2. if (!isset($_POST["username"])
  3. OR !isset($_POST["password"])
  4. OR !isset($_POST["securitytoken"])) {
  5. die ("Post parameters not right - Hacking attempt?");
  6. }
  7. require_once '../inc/init.php';
  8.  
  9. $username = mysql_real_escape_string($_POST["username"]);
  10. $password = mysql_real_escape_string($_POST["password"]);
  11.  
  12. $database->query("SELECT `id`, `password`, `name` FROM `accounts` WHERE name = '".($username)."'");
  13. if ($row = $database->fetch_next()) {
  14. if (hash('sha1',$password) == $row["password"] || sha1($password) == $row["password"]) {
  15. echo "Success";
  16. $_SESSION['moongra_user'] = $row["name"];
  17. $_SESSION['moongra_id'] = $row["id"];
  18. $_SESSION['moongra_sessionid'] = hash("sha512", $username + time());
  19. echo"<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=?page=ucp?do=account\">";
  20. } else {
  21. echo "Your password seems to be wrong. Please try again";
  22. }
  23. } else {
  24. echo "This account does not exist. Please try again";
  25. }
  26. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement