Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.90 KB | None | 0 0
  1. <html>
  2.  
  3. <head>
  4.  
  5. <script src='https://www.google.com/recaptcha/api.js'></script>
  6.  
  7. </head>
  8.  
  9. <body>
  10.  
  11. <br />
  12. <p>Please log in to your account below:</p>
  13.  
  14. <form action="index.php" method="post" target="_self">
  15. <b>User Name:</b><br>
  16. <input type="text" size="20" name="userid"><br />
  17. <br />
  18. <b>Password:</b><br>
  19. <input type="password" size="20" name="password"><br />
  20. <br />
  21.  
  22. <div class="g-recaptcha" data-sitekey="_MY PUBLIC SITE KEY_"></div>
  23. <br />
  24. <input type="submit" name="submit" value="Login">
  25. <input type="hidden" value="validate" name="content">
  26. </form>
  27.  
  28. <?php
  29.  
  30. if (isset($_POST['submit'])) {
  31. $userid = $_POST["userid"];
  32. $password = $_POST["password"];
  33. $secretkey = "_MY SECRET KEY_";
  34. $responsekey = $_POST["g-recaptcha-response"];
  35. $useripaddress = $_SERVER["REMOTE_ADDR"];
  36.  
  37. $url = "https://www.google.com/recaptcha/api/siteverify?secret={$secretkey}&respone={$responsekey}&remoteip={$useripaddress}";
  38. $response = file_get_contents($url);
  39. echo $response;
  40. }
  41.  
  42. require_once("scripts/thecrab.php");
  43.  
  44. $userid = htmlspecialchars($_POST['userid']);
  45. $password = htmlspecialchars($_POST['password']);
  46.  
  47. $query = "SELECT userid from users where userid = ? and password = PASSWORD(?)";
  48. $stmt = $pdo->prepare($query);
  49. $stmt->execute([$userid, $password]);
  50.  
  51. if (!$stmt->rowCount() & $response->success == 0) {
  52. echo "<h2>Sorry, your user account was not validated.</h2><br>n";
  53. echo "<a href="index.php?content=login">Try again</a><br>n";
  54. echo "<a href="index.php">Return to Home</a>n";
  55. } else {
  56. $_SESSION['valid_recipe_user'] = $userid;
  57. echo "<h2>Log In Successful</h2><br>n";
  58. echo "<a href="index.php"><img src="images/image-11.png"></a>n";
  59. }
  60. ?>
  61.  
  62. {
  63. "success": false,
  64. "error-codes": [
  65. "missing-input-response"
  66. ]
  67. }
  68.  
  69. if (!$stmt->rowCount() & $response->success == 0)
  70.  
  71. if (isset($_POST['submit'])) // Checks to see if the form was submitted
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement