Skip to content

Instantly share code, notes, and snippets.

@pingpoli
Created June 3, 2022 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pingpoli/76a5d9008179993ffc70a4bd2ea479e6 to your computer and use it in GitHub Desktop.
Save pingpoli/76a5d9008179993ffc70a4bd2ea479e6 to your computer and use it in GitHub Desktop.
<?php
if ( $_SERVER['REQUEST_METHOD'] == "POST" )
{
// check captcha
$xPos = $_POST['xPos'] ?? false;
$yPos = $_POST['yPos'] ?? false;
$sessionXPos = $_SESSION['captcha_x'] ?? false;
$sessionYPos = $_SESSION['captcha_y'] ?? false;
$xError = abs( $sessionXPos - $xPos );
$yError = abs( $sessionYPos - $yPos );
if ( $xPos !== false && $yPos !== false && $sessionXPos !== false && $sessionYPos !== false && $xError < 0.0001 && $yError < 0.0001 )
{
// process the contact request ...
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment