Drupal: preveri drzavo glede na IP

This commit is contained in:
Robert 2021-05-21 14:19:54 +02:00
parent 0143cef84e
commit ebed86c30f
2 changed files with 6 additions and 1 deletions

View File

@ -6,6 +6,7 @@
**/ **/
use
// Nastavimo url api-ja // Nastavimo url api-ja
$api_url = 'http://localhost/frontend/payments/api.php'; $api_url = 'http://localhost/frontend/payments/api.php';

View File

@ -1,5 +1,6 @@
<?php <?php
/** /**
* *
* Class ki vsebuje funkcije APIJA za narocila (oddaj narocilo, izvedi placilo...) * Class ki vsebuje funkcije APIJA za narocila (oddaj narocilo, izvedi placilo...)
@ -345,7 +346,10 @@ class ApiNarocilaController{
global $site_path; global $site_path;
$reader = new Reader($site_path.'admin/survey/modules/mod_geoIP/db/GeoLite2-City.mmdb'); $reader = new Reader($site_path.'admin/survey/modules/mod_geoIP/db/GeoLite2-City.mmdb');
$this->response['drzava'] = $reader->country($this->data['ip']); $podatki = $reader->city($this->data['ip']);
// Vrnemo ime države
$this->response['drzava'] = $podatki->country->name;
break; break;
} }