Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RN NukeSentinel(tm) issues
Author Message
griffinsbridge
New Member
New Member



Joined: Mar 12, 2006
Posts: 14
Location: Darkside of the Moon

PostPosted: Mon Oct 08, 2007 10:17 am Reply with quote

Hi

trying to do some Geolocation outside of Nuke sentinel.

Basically, just want to display the flag of where users are.

so would this be sufficient?
Code:


   $Geoip = ip2long($_SERVER['REMOTE_ADDR']);
$sqlGeo = 'SELECT c2c FROM nuke_nsnst_ip2country WHERE ip_lo <= "'.$Geoip.'" AND ip_hi >= "'.$Geoip.'"';
$resultGeo = $db->sql_query($sqlGeo);
$rowGeo = $db->sql_fetchrow($resultGeo);

if($rowGeo['c2c'] == ""){
$rowGeo['c2c'] = '00';
}


echo'<img src="images/nukesentinel/countries/'.$rowGeo['c2c'].'.png" />';


reason i ask is that Ive already implemented this, but sometimes people are coming up as 'unknown' yet in sentinel, they're showing a location.

thanks in advance

_________________
Danny Stewardson still owes me £4500.
Hope it chokes him 
View user's profile Send private message
jakec
Site Admin



Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom

PostPosted: Thu Oct 11, 2007 1:26 pm Reply with quote

<bump>
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Oct 11, 2007 7:27 pm Reply with quote

Try this:

$Geoip = ip2long($_SERVER['REMOTE_ADDR']);
$sqlGeo = 'SELECT distinct(c2c) FROM nuke_nsnst_ip2country WHERE "'.$Geoip.'" BETWEEN ip_lo AND ip_hi';
$resultGeo = $db->sql_query($sqlGeo);
if ($db->sql_numrows($resultGeo) > 0) {
$rowGeo = $db->sql_fetchrow($resultGeo);

if (empty($rowGeo['c2c'])) {
$rowGeo['c2c'] = '00';
}
}

echo '<img src="images/nukesentinel/countries/'.$rowGeo['c2c'].'.png" />';
 
View user's profile Send private message
emmaphp
Worker
Worker



Joined: Aug 22, 2006
Posts: 192

PostPosted: Sat Apr 19, 2008 9:11 am Reply with quote

Hi all,

I previously made a posting to do with GeoIP technology at the following link:

http://www.ravenphpscripts.com/posts11460-highlight-geoip.html

However I have just come across the info here and tried out code above that Raven suggested, just to see a working example of how this (GeoIP) technology can be of use, (i.e serving specific content to different users, depending on their geographic location and in this case simply displaying the relevant flag to a users location).

My first directly related point is that I used the code provided to create a simple module and when I visited the module directly from my ISP, it did indeed display the correct flag for my country/location.

I then tried to access the same module using a proxy server, (in this case www.megaproxy.com), to see a different flag displayed, however where there should have been a flag displayed, the image was simply missing. So, I am wondering why this would be, moreover, if for whatever reason the 'technology' cannot detect the correct image to display from the flag files/graphics already in nuke, I wonder if it is possible to display a generic/default image?

Next, I am wondering, instead of simply making different flags appear depending on a users location, how I can customise this solution.

What I thought was this scenario. I could have 4 different modules, each containing the same information, but in 4 different languages, (one in English, Spanish, French and Italian). How can I customise this solution to display content that has a link to the relevant module/full URL specific to the users location?
 
View user's profile Send private message
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> RN NukeSentinel(tm) issues

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©