Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 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. if ($_SESSION["securitytoken"] != $_POST["securitytoken"]) {
  9. echo "Refresh this page and try again";
  10. exit;
  11. }
  12.  
  13. $username = mysql_real_escape_string($_POST["username"]);
  14. $password = mysql_real_escape_string($_POST["password"]);
  15. $redirect = @$_POST["redirect"];
  16.  
  17. $database->query("SELECT `id`, `password`, `name`, FROM `accounts` WHERE name = '".($username)."'");
  18. if ($row = $database->fetch_next()) {
  19. if (hash('sha1',$password) == $row["password"] || sha1($password) == $row["password"]) {
  20. echo "Success";
  21. $_SESSION['moongra_user'] = $row["name"];
  22. $_SESSION['moongra_id'] = $row["id"];
  23. $_SESSION['moongra_sessionid'] = hash("sha512", $username + time());
  24. } else {
  25. echo "Your password seems to be wrong. Please try again";
  26. }
  27. } else {
  28. echo "This account does not exist. Please try again";
  29. }
  30. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement