-
-
Save pingpoli/617f1a5f2128bd95dcf5c1fb0fc085cc to your computer and use it in GitHub Desktop.
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
<?php | |
// CAPTCHA | |
// create two random values between 0 and 1 | |
$xPos = (float)rand()/(float)getrandmax(); | |
$yPos = (float)rand()/(float)getrandmax(); | |
$_SESSION['captcha_x'] = $xPos; | |
$_SESSION['captcha_y'] = $yPos; | |
?> | |
<script src="/js/pingpoliSliderCaptcha.js"></script> | |
<script> | |
function onSubmit() | |
{ | |
var captcha = new pingpoliSliderCaptcha(); | |
captcha.onsuccess = () => { | |
document.getElementById("xPos").value = <?php echo $xPos; ?>; | |
document.getElementById("yPos").value = <?php echo $yPos; ?>; | |
document.getElementById("contactForm").submit(); | |
}; | |
captcha.show( <?php echo $xPos; ?> , <?php echo $yPos; ?> ); | |
return false; | |
} | |
</script> | |
<form action="contact.php" method="POST" id="contactForm" onsubmit="return onSubmit()"> | |
<input type="email" name="email" id="email" maxlength="256" placeholder="Your Email" required><br><br> | |
<textarea name="text" id="text" required></textarea><br><br> | |
<input type="hidden" id="xPos" name="xPos" value="-1"> | |
<input type="hidden" id="yPos" name="yPos" value="-1"> | |
<button>Send</button> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment