차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

다음 판
이전 판
tech:what_is_my_ip [2014/09/20 15:17] – 만듦 V_Ltech:what_is_my_ip [2016/07/12 00:56] (현재) – 바깥 편집 127.0.0.1
줄 1: 줄 1:
-====== What Is My Ip ======+{{tag>ip주소 php}} 
 +====== IP주소 알아내기.php  ====== 
 + 
 + 
 +<file php> 
 +<?php function getRealIpAddr() 
 +
 +    if (!empty($_SERVER['HTTP_CLIENT_IP']))   //check ip from share internet 
 +    { 
 +      $ip=$_SERVER['HTTP_CLIENT_IP']; 
 +    } 
 +    elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))   //to check ip is pass from proxy 
 +    { 
 +      $ip=$_SERVER['HTTP_X_FORWARDED_FOR']; 
 +    } 
 +    else 
 +    { 
 +      $ip=$_SERVER['REMOTE_ADDR']; 
 +    } 
 +    return $ip; 
 +
 + 
 +echo "your IP address is ".getRealIpAddr()."<BR>"; 
 +?> 
 +</file> 
 + 
 +같은 것인데 더 짧게... 
 + 
 +<file php> 
 +<?php 
 +$domain=$_SERVER['REMOTE_ADDR']; 
 +$domain1 = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; 
 +echo "Viewer Server's (Remote) IP Address: <strong>$domain</strong> - "; 
 +echo "Viewer Real (Local-Machine) IP Address: <strong>$domain1</strong>"; 
 +?> 
 +</file>
  
  
줄 5: 줄 40:
  
  
-{{tag>what is my ip}}