PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
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 Back to top

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
View user's profile Send private message
jakec
Site Admin


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

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

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


Joined: Aug 27, 2002
Posts: 16987
Location: Kansas

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

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 Visit poster's website AIM Address Yahoo Messenger
emmaphp
Worker
Worker


Joined: Aug 22, 2006
Posts: 192

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

Hi all,

I previously made a posting to do with GeoIP technology at the following link:
Only registered users can see links on this board!
Get registered or login to the forums!


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
Only registered users can see links on this board!
Get registered or login to the forums!
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.

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum