Commit eb73d5cd by jenkins

Merge Request accepted by jenkins build success

parents 6431abfb 33639c7a
Pipeline #508 failed with stage
in 0 seconds
...@@ -396,6 +396,34 @@ $selected_id = isset( $_GET['course'] ) ? $_GET['course'] : - 1; ...@@ -396,6 +396,34 @@ $selected_id = isset( $_GET['course'] ) ? $_GET['course'] : - 1;
<option value="ZW" >Zimbabwe</option> <option value="ZW" >Zimbabwe</option>
</select> </select>
</div> </div>
<?php
function getUserIP()
{
$ipaddress = '';
if (getenv('HTTP_CLIENT_IP'))
$ipaddress = getenv('HTTP_CLIENT_IP');
else if(getenv('HTTP_X_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_X_FORWARDED_FOR');
else if(getenv('HTTP_X_FORWARDED'))
$ipaddress = getenv('HTTP_X_FORWARDED');
else if(getenv('HTTP_FORWARDED_FOR'))
$ipaddress = getenv('HTTP_FORWARDED_FOR');
else if(getenv('HTTP_FORWARDED'))
$ipaddress = getenv('HTTP_FORWARDED');
else if(getenv('REMOTE_ADDR'))
$ipaddress = getenv('REMOTE_ADDR');
else
$ipaddress = 'Unknown IP Address';
return $ipaddress;
}
$user_ip = getUserIP();
echo $user_ip; // Output IP address (Ex: 123.345.456.678)
?>
<script type="text/javascript"> <script type="text/javascript">
...@@ -403,17 +431,14 @@ $selected_id = isset( $_GET['course'] ) ? $_GET['course'] : - 1; ...@@ -403,17 +431,14 @@ $selected_id = isset( $_GET['course'] ) ? $_GET['course'] : - 1;
var ips ='00'; var ips ='00';
$.getJSON('https://json.geoiplookup.io/api?callback=?', function(data) { ips = '<?php echo ($user_ip); ?>';
//console.log(data.ip);
ips = data.ip; //console.log(ips);
$.getJSON("https://cors-anywhere.herokuapp.com/http://www.geoplugin.net/json.gp?ip="+ips,function(response){ $.getJSON("https://cors-anywhere.herokuapp.com/http://www.geoplugin.net/json.gp?ip="+ips,function(response){
$('#country_code').val(response.geoplugin_countryCode); $('#country_code').val(response.geoplugin_countryCode);
}); });
});
}); });
</script> </script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment