...

View Full Version : country(Area) detection



deshi2003
03-18-2009, 11:22 PM
please say me how could i know from which part of the world my website is accessing. i need it for the development of my website(php based)

mperez6109
03-19-2009, 01:08 AM
Hi deshi2003,

I am not sure if I understand your question. The way I find out where my users are coming from is by using funnel web or google analytics. If you really want to be more snicky, I could use some thing like this:



<?php
$email = "someone@gmail.com"; // ENTER YOUR EMAIL ADDRESS HERE

if ($_SERVER['REMOTE_ADDR'] != "128.223.188.97") {
if(array_key_exists("HTTP_REFERER",$_SERVER)) {
$body = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']."\n".
date("Y-m-d H:i:s")."\n".
$_SERVER['REMOTE_ADDR']."\n".
gethostbyaddr($_SERVER['REMOTE_ADDR'])."\n".
$_SERVER['HTTP_REFERER'];
} else {
$body = $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']."\n".
date("Y-m-d H:i:s")."\n".
$_SERVER['REMOTE_ADDR']."\n".
gethostbyaddr($_SERVER['REMOTE_ADDR']);
}
mail($email, $_SERVER['REQUEST_URI'], $body, "From: ".$_SERVER['REMOTE_ADDR']." <".$email.">");
}
?>
You have reached this page in error. Please click <b><a href="http://www.somesite.com">here</a></b> to return to the original page.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum