Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $error = false;
- $captchaError = false;
- if($_POST) {
- $username = $_POST["username"];
- if (!preg_match("/^[0-9A-Za-z_]{3,16}+$/", $username)) {
- $error = true;
- }
- $email = $_POST["email"];
- if (!filter_var($email, FILTER_VALIDATE_EMAIL) || strlen($email) > 50) {
- $error = true;
- }
- $password = $_POST["password"];
- if(!preg_match("/^[-0-9A-Za-z!@#$%^&*_+=]{6,}+$/", $password)) {
- $error = true;
- }
- $captcha = $_POST['g-recaptcha-response'];
- $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$SECRETKEY&response=".$captcha."&remoteip=".$_SERVER['REMOTE_ADDR']), true);
- if(!$captcha || $response['success'] == false) {
- $captchaError = true;
- }
- if((!$error) && (!captchaError)) {
- include("../res/db.php");
- $prep = $conn->prepare("SELECT * FROM users WHERE name=?");
- $prep->bind_param("s", $username);
- $prep->execute();
- $prep->store_result();
- echo "why doesn't this run??";
- var_dump($prep->num_rows);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement