Commit c27afe5f261386bcf219738dcc8c9d5dce7cf93a

Authored by michael
1 parent 7b6cb9bd

fixed ip retrieval code


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1496 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing 1 changed file with 6 additions and 6 deletions
lib/session/Session.inc
@@ -160,16 +160,16 @@ class Session { @@ -160,16 +160,16 @@ class Session {
160 * Retrieves and returns the IP address of the current user 160 * Retrieves and returns the IP address of the current user
161 */ 161 */
162 function getClientIP() { 162 function getClientIP() {
163 - // get client ip  
164 - if(getenv("HTTP_CLIENT_IP")) {  
165 - $ip = getenv("HTTP_CLIENT_IP"); 163 + // get client ip
  164 + if (getenv("REMOTE_ADDR")) {
  165 + $ip = getenv("REMOTE_ADDR");
166 } elseif(getenv("HTTP_X_FORWARDED_FOR")) { 166 } elseif(getenv("HTTP_X_FORWARDED_FOR")) {
167 $forwardedip = getenv("HTTP_X_FORWARDED_FOR"); 167 $forwardedip = getenv("HTTP_X_FORWARDED_FOR");
168 list($ip,$ip2,$ip3,$ip4)= split (",", $forwardedip); 168 list($ip,$ip2,$ip3,$ip4)= split (",", $forwardedip);
169 - } else {  
170 - $ip = getenv("REMOTE_ADDR"); 169 + } elseif (getenv("HTTP_CLIENT_IP")) {
  170 + $ip = getenv("HTTP_CLIENT_IP");
171 } 171 }
172 return $ip; 172 return $ip;
173 - } 173 + }
174 } 174 }
175 ?> 175 ?>