<html>
<head>
<title>What is my IP address and Country</title>
</head>
<body>
<?
if (getenv(HTTP_X_FORWARDED_FOR)) {
$pipaddress = getenv(HTTP_X_FORWARDED_FOR);
$ipaddress = getenv(REMOTE_ADDR);
echo "Your Proxy IP address is : ".$pipaddress. " (via $ipaddress) " ;
} else {
$ipaddress = getenv(REMOTE_ADDR);
echo "My IP address is : $ipaddress";
}
$country = getenv(GEOIP_COUNTRY_NAME);
echo "<br />My Country : $country<br />";
echo date('l jS \of F Y h:i:s A');
?>
</body>
</html>
-- Begin step 'APXSing mod_geoip into apache' --
/usr/local/apache/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -m64 -fPIC -DPIC -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/local/apache/include -I/usr/local/apache/include -I/usr/local/apache/include -I/opt/geoip/include -c -o mod_geoip.lo mod_geoip.c && touch mod_geoip.slo
mod_geoip.c: In function 'geoip_header_parser':
mod_geoip.c:323: error: 'conn_rec' has no member named 'remote_ip'
mod_geoip.c:326: warning: implicit declaration of function 'ap_add_common_vars'
mod_geoip.c:341: error: 'conn_rec' has no member named 'remote_ip'
apxs:Error: Command failed with rc=65536
.
!! '/usr/local/apache/bin/apxs -i -a -L/opt/geoip/lib -I/opt/geoip/include -lGeoIP -c mod_geoip.c' failed with exit code '256' !!
!! Restoring original working apache !!
#wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
#gunzip GeoLiteCity.dat.gz
#cp GeoLiteCity.dat /usr/local/share/GeoIP/
<?php
$country = $_SERVER["GEOIP_COUNTRY_NAME"];
echo "<br />My Country : $country<br />";
?>
_SERVER["GEOIP_COUNTRY_NAME"]
_SERVER["GEOIP_LATITUDE"]
_SERVER["GEOIP_LONGITUDE"]
_SERVER["GEOIP_COUNTRY_CODE"]
#ls -ald /usr
#ls -ald /usr/local
#ls -ald /usr/local/share
#ls -ald /usr/local/share/GeoIP
#ls -ald /usr/local/share/GeoIP/GeoIPCity.dat
GeoIPEnable On