Thank you very much, and for example for that reward is see on the web? I mean that if someone comes from a country you see the reward that will win
Oops, I forgot about that. In order to have it display them properly you would need to move some things around, but it still isn't that difficult.
So, at line 2218 on your
index.php we're going to get the user's country and such. Put this code there:
//This code determines the reward
$countryCode = json_decode(file_get_contents('http://freegeoip.net/json/' . getIP()))->country_code;
$rewardMultiplier = 1;
if($countryCode == 'GB'){
$rewardMultiplier = 1.1;
}
Rather than times everything individually, we're going to create a multiplier variable to times everything by.
Also, I noticed that I used 0.1 rather than 1.1 in my previous example. This would give 10% of the expected reward rather than 110%, so unless you want to decrease the reward the multiplier should always be greater than 1.
After this, at line 2232 (before
if(count($rewards) > 1) {) add this code:
foreach($rewards as $rW){
$rW *= $rewardMultiplier;
$newRewards[] = $rW;
}
$rewards = $newRewards;
If I am right this will get every reward from the array and times it by the multiplier (therefore 1.1 (110%) if the user is in GB). I would appreciate if someone else could check this first before anyone puts it into any live code though, since I am prone to making mistakes when coding directly into BitcoinTalk.
After this, be sure to revert the changes at line 2310 to this:} else {
$ret = $fb->send($address, $reward);
}
Else the user will get the amount multiplied by more than you want, costing you money.
My apologies for not getting the code right the first time, I hope it didn't cause you any issues.
Hi Sir i tried this code & get following errors if you please take a look at them and modify the code.
Notice: Trying to get property of non-object in /home/lyqan/public_html/index.php on line 2219
Fatal error: Unsupported operand types in /home/lyqan/public_html/index.php on line 2240
In my index.php code at line 2219
$countryCode = json_decode(file_get_contents('http://freegeoip.net/json/' . getIP()))->country_code;
& at line 2240
$rW *= $rewardMultiplier;
Thanks.