Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    74
    Thanks
    2
    Thanked 0 Times in 0 Posts

    country(Area) detection

    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)

  • #2
    New Coder
    Join Date
    Mar 2009
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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:

    Code:
    <?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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •