Created
December 2, 2024 08:00
-
-
Save ramonfincken/513b6ccb34c9ba415b4a3e21ba180ed9 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
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