Advertisement
Guest User

Untitled

a guest
Jul 4th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. <?php
  2. $error = false;
  3. $captchaError = false;
  4. if($_POST) {
  5. $username = $_POST["username"];
  6. if (!preg_match("/^[0-9A-Za-z_]{3,16}+$/", $username)) {
  7. $error = true;
  8. }
  9. $email = $_POST["email"];
  10. if (!filter_var($email, FILTER_VALIDATE_EMAIL) || strlen($email) > 50) {
  11. $error = true;
  12. }
  13. $password = $_POST["password"];
  14. if(!preg_match("/^[-0-9A-Za-z!@#$%^&*_+=]{6,}+$/", $password)) {
  15. $error = true;
  16. }
  17. $captcha = $_POST['g-recaptcha-response'];
  18. $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$SECRETKEY&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']), true);
  19. if(!$captcha || $response['success'] == false) {
  20. $captchaError = true;
  21. }
  22. if((!$error) && (!captchaError)) {
  23. include("../res/db.php");
  24. $prep = $conn->prepare("SELECT * FROM users WHERE name=?");
  25. $prep->bind_param("s", $username);
  26. $prep->execute();
  27. $prep->store_result();
  28. echo "why doesn't this run??";
  29. var_dump($prep->num_rows);
  30. }
  31. }
  32. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement