CodeCanyon

Country Detect & Redirect

How to redirect an entire continent?

That’s say you want to redirect users from America to a specified URL .

CountryDetector::redirect("america", "http://myurl");

but you want to exclude Mexicans, here is the part of code

CountryDetector::redirect("america", "http://myurl", "MX");

As a third parameter is array of countries that will not affected on redirect, and MX is country code for Mexico.

How to call back a function?

First you must define functions that will be used on callbacks example:

function unitedStates()
{
 echo "Callback for United States of America";
}

then you can add function name on callback() function as on given example:

CountryDetector::callback("US", "unitedStates");

How to include file?

The usage of function is the same as on redirect() or callback() the only things that changes is second parameter, in this case name of method tells us for file to include. That’s see how:

CountryDetector::includeFile(array("US", "DE"), "my_special_file.php");

In first parameter we send an array. You are allowed to send whether array or string, it’s on yours, but with array you can include specific countries that you may need to do separate actions.

Showed in examples are United States and Germany.

by
by
by
by
by