Created
November 27, 2023 01:33
-
-
Save stevesohcot/ac228685a91dead41eb48d0698389641 to your computer and use it in GitHub Desktop.
Google recaptcha with PHP - sign up form (v2)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Google reCAPTCHA Example</title> | |
<link | |
rel="stylesheet" | |
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | |
integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" | |
crossorigin="anonymous"> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<div id="form-container" class="mt-4"> | |
<form action="controller-sign-up.php" method="post"> | |
<h2>Sign Up</h2> | |
<div class="mb-4"> | |
<label class="form-label" for="email">Email address</label> | |
<input type="email" name="email" id="email" class="form-control" /> | |
</div> | |
<div class="mb-4"> | |
<label class="form-label" for="password">Password</label> | |
<input type="password" name="password" id="password" class="form-control" /> | |
</div> | |
<div id="google-recaptcha-checkbox"></div> | |
<input type="hidden" name="signUpAttempt" value="1"> | |
<input type="submit" class="btn btn-primary btn-block mb-4" value="Sign Up"> | |
</form> | |
</div> | |
<script src="https://www.google.com/recaptcha/api.js?onload=onloadCallback&render=explicit" | |
async defer> | |
</script> | |
<script type="text/javascript"> | |
var onloadCallback = function() { | |
grecaptcha.render('google-recaptcha-checkbox', { | |
'sitekey' : 'my-ste-key-goes-here' | |
}); | |
}; | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment