Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- $sql = 'SELECT `ip_address` FROM `X` '; // read userips
- if(!$result = $db->query($sql)){die('There was an error running the query [' . $db->error . ']');} // if connection failed
- ?>
- <script type="text/javascript">
- //jvectormap data
- var visitorsData = {
- <?php
- while($row = $result->fetch_assoc()){
- require_once('widgets/IP2Location.php');
- // Standard lookup with no cache
- $loc = new IP2Location('widgets/IP-COUNTRY-SAMPLE.BIN');
- $ip = $row['ip_address'];
- $record = $loc->lookup($ip, IP2Location::ALL);
- $countrycode = $record->countryCode ;
- // alle rows einmal durchgehen, ip in countrynamen ändern dann auslesen wie oft (countryname1) vorkommt und dann das hinter (countryname1) echon
- //ausgeben
- echo json_encode($countrycode); echo': ';echo substr_count($countrycode, $countrycode); //echot die anzahl wie oft $countrycode in $countrycode vorkommt (bisher immer 1x weil jede reihe einzeln gezählt wird)
- echo','; }?>"CN": 3,};
- </script>
- <?
- $result->free(); // result freigeben für mehr leistung ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement