mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 09:19:22 +02:00
* automatically detect player country based on user location (IP) on create account
This commit is contained in:
parent
45aa2c2f23
commit
603c2175e3
@ -85,6 +85,7 @@ $config = array(
|
||||
'account_welcome_mail' => true, // send welcome email when user registers
|
||||
'account_mail_change' => 2, // how many days user need to change email to account - block hackers
|
||||
'account_country' => true, // user will be able to set country of origin when registering account, this information will be viewable in others places aswell
|
||||
'account_country_recognize' => true, // should country of user be automatically recognized by his IP? This makes an external API call to http://ipinfo.io
|
||||
'account_change_character_name' => false, // can user change their character name for premium points?
|
||||
'account_change_character_name_points' => 30, // cost of name change
|
||||
'account_change_character_sex' => false, // can user change their character sex for premium points?
|
||||
|
@ -384,6 +384,14 @@ function validate_form(thisform)
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
$country_recognized = null;
|
||||
if($config['account_country_recognize']) {
|
||||
$info = json_decode(@file_get_contents('http://ispinfo.io/' . $_SERVER['REMOTE_ADDR'] . '/geo'), true);
|
||||
if(isset($info['country'])) {
|
||||
$country_recognized = strtolower($info['country']);
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($errors))
|
||||
output_errors($errors);
|
||||
?>
|
||||
@ -446,7 +454,7 @@ Also you have to agree to the terms presented below. If you have done so, your a
|
||||
|
||||
echo '<option value="">----------</option>';
|
||||
foreach($config['countries'] as $code => $c)
|
||||
echo '<option value="' . $code . '"' . ((isset($country) && $country == $code) ? ' selected' : '') . '>' . $c . '</option>';
|
||||
echo '<option value="' . $code . '"' . (((isset($country) && $country == $code) || (!isset($country) && $country_recognized == $code)) ? ' selected' : '') . '>' . $c . '</option>';
|
||||
?>
|
||||
</select>
|
||||
<img src="" id="account_country_img"/>
|
||||
|
Loading…
x
Reference in New Issue
Block a user