Get Hostname Behind Proxies

Get Hostname Behind ProxiesThis is a very simple code and works for anybody who is behind proxies and people who are not. This mightbe usfull if your have cable users visiting your site.

<?php $ip = getenv('REMOTE_HOST');
if(!$ip) {
$ip = getenv('HTTP_X_FORWARDED_FOR');
}
if(!$ip) {
$ip = $HTTP_X_FORWARDED_FOR;
}
if(!$ip) {
$ip = getenv('REMOTE_ADDR');
}
if(!$ip) {
$ip = $REMOTE_ADDR;
}
$ip = @GetHostByAddr($ip);
echo $ip;
?>

Related Articles

  • Display ISP
    Display someones ISP on your site.
  • PHP User Stats
    In this tutorial I am going to teach you how to make a User Stats menu in PHP and MySQL which displays: Unique hits, Unique hits today, Total hits, Total hits today. If you dont have MySQL you can get one for free here.
  • How to create a blog
    Blogs are more permanent than posts to an online discussion list, more dynamic than older-style home pages. They are more personal than traditional journalism, and definitely more public than diaries. A blog is often a mixture of what is happening in a persons life and what is happening on the Web....
  • Save $100 In 5 Minutes Backing Up Your Web Site?
    Heres an easy way to backup your web sites files and database (worth thousands of dollars, no doubt) that costs $0 to learn and perform. It only takes seven easy steps.
    You dont need to know a lot about how to use Unix or how to use databases like mySQL. The only real tool you need is a tel...
  • Web Services Interoperability
    Interoperability is one of the main promises of Web services. Web services are designed to be independent of the underlying operating system and programming language.
    In this article we will address some basic web services interoperability issues that are useful for developers. We will focus on...
  • Towards Next Generation URLs
    For many years we have heard about the impending death of URLs that are difficult to type, remember and preserve. The use of URLs has actually improved little thus far, but changes are afoot in both development practices and Web server technology that should help advance URLs to the next generati...
  • Search Engine Strategies Conference Chicago 2003 Reviewed
    Search Engine Strategies Conference and Expo is an event that brings together most talented and famous Search Engine Marketing professionals in the world. This event is held several times a year all over the world, and is hosted by JupiterMedia and SearchEngineWatch.com. Danny Sullivan is the name b...

Contact Web Design Outsource and get started today

Need Website Designing, Development, Redesigning, Maintenance and SEO services or help growing your company's web presence? Request a free Quote Now.