Skip to content

Instantly share code, notes, and snippets.

@ramonfincken
Created December 2, 2024 08:00
Show Gist options
  • Save ramonfincken/513b6ccb34c9ba415b4a3e21ba180ed9 to your computer and use it in GitHub Desktop.
Save ramonfincken/513b6ccb34c9ba415b4a3e21ba180ed9 to your computer and use it in GitHub Desktop.
<?php
if (!defined("WHMCS")) {
die("This file cannot be accessed directly");
}
add_hook( 'ShoppingCartValidateDomain', 1, function ( $vars ) {
if ( $vars['domainoption'] != 'register') {
return [];
}
$domain = $vars['sld'].$vars['tld'];
if( !$domain ) {
return [];
}
// Do your magic
$regexPattern = '';
// Check if the domain matches the fraudulent pattern
if( preg_match( $regexPattern, $domain ) ) {
// Return a fraud message; this prevents the order from proceeding
return [
'domain' => 'The domain matches a fraudulent pattern and cannot be registered.',
];
}
// If no fraud detected, return nothing
return [];
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment