Jump to content

Suspend package based on clients location


Recommended Posts

Hi WHMCS users!

 

Here is my most recent hook! It is designed to suspend packages ordered by users in certain countries, defined by an array.

 

  • A user orders a product defined in an array inside the hook
  • The users IP address and Country is validated against a list of countrys to deny activation
  • If the users country is in the list the hook will suspend the users product & notify both the user and admin

 

It is a very simple hook and requires minor configuration to operate correctly.

 

$url = ""; # URL to WHMCS , no trailing slash
$urlapi = ""; # URL to WHMCS API file
$username = ""; # Admin username goes here
$password = ""; # Admin password goes here
$packagenum=array("2"); # Array of the packages to validate on
$banned=array("ru", "ro" ,"us"); # Array of lower case country codes to validate on

 

The $packagenum should contain an array of packages you want to validate, for example, package #2 for me is a Free Trial package

 

The $banned should contain an array of country codes, lower case, that match the WHMCS profile fields & the iptolocation fields (they are standard codes), example - ru, ro, us, au, de

 

If there are more questions about the config please reply, everything else seems standard.

 

 

Installing:

  1. Download the database script @ http://gamecp.com/iptocountry.sql
  2. Import the table to your WHMCS database
  3. Configure the validate_country.php with a list of packages and countrys to ban
  4. Upload the validate_country.php file to your hooks folder
  5. Enjoy!

 

If you find this useful send me a donation! gcphost AT gmail DOT com via PayPal - or email me - as I accept many forms of payment.

validate_country.zip

Link to comment
Share on other sites

Please use the revised file here, I failed to realize some of the setting variables seem to conflict with the user login system of WHMCS (oops!) - updating the names has fixed the issue.

 

$plug_banned=array("ru", "ro");
$plug_url = ""; # URL to WHMCS API file
$plug_urlapi = ""; # URL to WHMCS API file
$plug_username = ""; # Admin username goes here
$plug_password = ""; # Admin password goes here
$plug_packagenum=array("2");

validate_country.zip

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated