samuraiartguy

Reusable Forms reCaptcha - handeler.php

Feb 11th, 2022
1,032
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. This is handler.php
  2.  
  3. <?php
  4. ini_set('display_errors', 1);
  5. ini_set('display_startup_errors', 1);
  6. error_reporting(E_ALL);
  7. /*
  8. Tested working with PHP5.4 and above (including PHP 7 )
  9.  
  10.  */
  11. require_once './vendor/autoload.php';
  12.  
  13. use FormGuide\Handlx\FormHandler;
  14.  
  15.  
  16. $pp = new FormHandler();
  17.  
  18. $validator = $pp->getValidator();
  19. $validator->fields(['Name','Email'])->areRequired()->maxLength(50);
  20. $validator->field('Email')->isEmail();
  21. $validator->field('Message')->maxLength(6000);
  22.  
  23.  
  24. $pp->requireReCaptcha();
  25. $pp->getReCaptcha()->initSecretKey('6LclqhYUAAAAAAjw0UUU3Gw9KxCB0TpiL923HmiE');
  26.  
  27.  
  28. $pp->sendEmailTo('[email protected]'); // ← Your email here
  29.  
  30. echo $pp->process($_POST);
Advertisement
Add Comment
Please, Sign In to add comment