Guest User

WHMCS blacklist check on ticket-form 2

a guest
Oct 16th, 2024
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. <?php
  2.  
  3. if (!defined("WHMCS"))
  4. die("This file cannot be accessed directly");
  5.  
  6. use WHMCS\Database\Capsule;
  7.  
  8. add_hook('TicketOpenValidation', 1, function($vars) {
  9.  
  10. if (isset($vars['email']) && $vars['email'] != ""){
  11.  
  12. $useremail = strtolower($vars['email']);
  13.  
  14. if (!filter_var($useremail, FILTER_VALIDATE_EMAIL)) {
  15. return 'Invalid email format.';
  16. }
  17.  
  18. $blocked = Capsule::table('tblticketspamfilters')
  19. ->where('type', 'sender')
  20. ->where('content', $useremail)
  21. ->exists();
  22.  
  23. if ($blocked) {
  24. return 'Sorry, you cannot open a ticket.';
  25. }
  26.  
  27. }
  28. });
  29.  
Advertisement
Add Comment
Please, Sign In to add comment