Home  >  Article  >  php教程  >  php 获取用户IP与IE信息程序

php 获取用户IP与IE信息程序

WBOY
WBOYOriginal
2016-06-08 17:29:44995browse

php 获取用户IP与IE信息程序

function onlineip()
 {
  global $_SERVER;
  if(getenv('HTTP_CLIENT_IP'))
  {
   $onlineip = getenv('HTTP_CLIENT_IP');
  }
  elseif(getenv('HTTP_X_FORWARDED_FOR'))
  {
   list($onlineip) = explode(',', getenv('HTTP_X_FORWARDED_FOR'));
  }
  elseif(getenv('REMOTE_ADDR'))
  {
   $onlineip = getenv('REMOTE_ADDR');
  }
  else
  {
   $onlineip = $_SERVER['REMOTE_ADDR'];
  }
  return $onlineip;
 }
 function imgdecode($string)
 {
  global $_SERVER;

  $key = md5(onlineip()."\t".$_SERVER['HTTP_USER_AGENT']);
  $coded = '';
  $string = base64_decode($string);
  $keylength = strlen($key);
  for($i = 0; $i   {
   $coded .= substr($string, $i, $keylength) ^ $key;
  }
  return $coded;
 }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn