Kazuldur How to set different rewards for different countries?
That requires a bit of extra modification to the FaucetBox file, but it isn't difficult. Personally I think the easiest way to do it would be by using a geoip API, however this may be inaccurate. The API that I'll be using in this example is
freegeoip. This API has a limit of 10,000 requests per hour, so I can't imagine it would reach the cap for a faucet. Code is untested as always.
On line 2309 in
index.php add this code to get the country code, since it's easier to use:
$countryCode = json_decode(file_get_contents('http://freegeoip.net/json/' . getIP()))->country_code;
This will return the user's
country code in ISO form, for example GB for United Kingdom.
You can then just check the country code before sending the reward and adjust the amount, for example:
if($countryCode == 'GB'){
$reward *= 0.1;
}
This code would increase the amount given to any user in the United Kingdom by 10% (or the multiplier of 0.1). You could obviously go into detail a lot with this, but I'm not going to because the rest is self explanatory.
Another way that this could be done would be by using the
geoip_country_by_name in PHP's geoip framework, however this framework may not be available to the majority of hosting users due to it having to
usually be installed separately to PHP.
If you're using this though, you could probably just replace the first line of code with:
$countryCode = geoip_get_country_by_name($hostnames->hostnames);
And it would likely return the same result.
Lol... So you would give people less or more satoshi based on the country they live in? What does the "cost of living" have to do with anything? I'm not seeing it.
I believe that some faucets use it to adjust rates due to advertising income. For countries such as Russia and Ukraine which bring in less money they get smaller rewards than countries like the US and UK which bring in more advertising revenue.
We know that life is more expensive in some countries than in others, how is it possible that you have not yet implemented this in the script?
Since it requires an external API to be used, or more server usage on a service like NastyHosts, and I can't imagine it would be too easy to make a UI which would work well for a faucet owner to change countries' rewards. That and it could probably be abused by users using VPNs and Proxies to get larger rewards.