Jump to content
php.lv forumi

kā noteikt IP, OS, Brauzeri???


Recommended Posts

Posted
  echo 'Tava IP ir: ', $_SERVER['REMOTE_ADDR'], "\n";
  echo 'Browseris\OS: ', $_SERVER['HTTP_USER_AGENT'], "\n";

Posted

Gribu papildinaat, ka dereetu njemt veeraa Opera's user-agent feikoshanu, ko var viegli detekteet, jo Opera feikotajam user-agent stringam beigaas piemet "Opera/x.yy". Respektiivi:

 

$opera = strstr($_SERVER['HTTP_USER_AGENT'], 'Opera');
if (!empty($opera)) {
  $userAgent = $opera;
}
else {
  $userAgent = $_SERVER['HTTP_USER_AGENT'];
}

 

Gan jau liidziigi var noteikt arii kaadus citus paarluukus, kas vilto user-agentu.

×
×
  • Create New...