Strana 1 z 1

Typu Browseru & OS

Napísané: Ne Jan 29, 2006 5:46 pm
od používateľa Kissman
jde to pres php...? zkousel sem to ale nikdy sem nedal dohromady kod kterejch bych mohl vlozit a zformatovat podle potreby.

Napísané: Ne Jan 29, 2006 5:52 pm
od používateľa _rasel^
Tu je nieco cim sa mozes inspirovat:

Kód: Vybrať všetko

http://pecan.wz.cz/index.php?clanek=php_stats
:D

Napísané: Po Jan 30, 2006 3:50 am
od používateľa grabo
Browser snippet:
$curos=strtolower($_SERVER['HTTP_USER_AGENT']);

if (strstr($curos,"gecko")) {
if (strstr($curos,"firefox")) {
$browser="Firefox";
} else if (strstr($curos,"netscape")) {
$browser="Netscape";
} else { $browser="Mozilla";
}
} else if (strstr($curos,"opera")) {
$browser="Opera";
} else if (strstr($curos,"msie")) {
$browser="Internet Explorer";
} else if (strstr($curos,"voyager")) {
$browser="Voyager";
} else { $browser="[?]EgzoticalBrowser";
$browser="DontKnow";
}

return $browser;
Ukážka je napr. na

Kód: Vybrať všetko

http://ziza.fbi.cz

Napísané: Po Jan 30, 2006 3:36 pm
od používateľa _rasel^
2 grabo: Thx...

..

Napísané: Po Jan 30, 2006 4:03 pm
od používateľa Kissman
jj.. je to supr.. diky

...

Napísané: Po Jan 30, 2006 11:48 pm
od používateľa Kissman
k tomu os... nasel sem toto...

Kód: Vybrať všetko

function platformDetect()
{
if(navigator.appVersion.indexOf("Win") != -1)
{
alert("Windows");
}
else if(navigator.appVersion.indexOf("Mac") != -1)
{
alert("Macintosh");
}
else alert("Other");
}

Napísané: Ut Jan 31, 2006 6:01 pm
od používateľa _rasel^
Super funkcia od Yoz-a (mnou troska upravena). Je tam aj odchytavanie verzii. :D

Kód: Vybrať všetko

function HUA($type='browser_family', $HUA=false){ 
   if(!$HUA) $HUA=$_SERVER['HTTP_USER_AGENT']; 
   switch($type){ 
      case 'os': 
      case 'os_family': 
      case 'operating_system': 
      case 'operating_system_family': 
         if(preg_match("/(Windows 98|Win98)/iu", $HUA, $matches)){       $f='Windows'; $v='98'; 
         }elseif(preg_match("/(Windows CE|WinCE)/iu", $HUA, $matches)){  $f='Windows'; $v='CE'; 
         }elseif(preg_match("/(Win 9x)/iu", $HUA, $matches)){            $f='Windows'; $v='9x'; 
         }elseif(preg_match("/(Win32)/iu", $HUA, $matches)){             $f='Windows'; $v='32'; 
         }elseif(preg_match("/(Windows 95|Win95)/iu", $HUA, $matches)){  $f='Windows'; $v='95'; 
         }elseif(preg_match("/(Windows NT 5\.1)/iu", $HUA, $matches)){   $f='Windows'; $v='XP';
         }elseif(preg_match("/(Windows( |-)NT)/iu", $HUA, $matches)){    $f='Windows'; $v='NT';
         }elseif(preg_match("/(Windows)/iu", $HUA, $matches)){           $f='Windows';
         }elseif(preg_match("/(WinNT4.0)/iu", $HUA, $matches)){          $f='Windows'; $v='NT 4.0';
         }elseif(preg_match("/(Mac)/iu", $HUA, $matches)){               $f='Mac'; 
         }elseif(preg_match("/(U; ([^;\(\)]+))/iu", $HUA, $matches)){    $f='Unix'; $v=trim($matches[2]).')';
         }elseif(preg_match("/(i686 Linux)/iu", $HUA, $matches)){        $f='Unix'; $v='Linux';
         }elseif(preg_match("/(Linux( [0-9\.]+)?)/iu", $HUA, $matches)){ $f='Unix'; $v='Linux'.(trim($matches[2])?' '.trim($matches[2]):'')."";
         }elseif(preg_match("/(Symbian OS)/iu", $HUA, $matches)){        $f="Symbian";
         }else return false; 
         switch($type){ 
            case 'operating_system_family': 
            case 'os_family':   return $f; 
            default: return $f.($v?' '.$v:''); 
         } 
      break; 
      default: 
         if(preg_match("/(?:(Opera)(?: |\/)([0-9]+(?:\.[0-9]+)?))/iu",$HUA, $matches)){ 
         }elseif(preg_match("/(?:(Firefox)\/([0-9]+(?:.[0-9]+)?))/iu",$HUA, $matches)){ 
         }elseif(preg_match("/(?:(MSIE) ([0-9]+(?:\.[0-9]+)?))/iu",$HUA, $matches)){ 
         }elseif(preg_match("/(?:(Konqueror)\/([0-9]+(?:\.[0-9]+)?))/iu",$HUA, $matches)){ 
         }elseif(preg_match("/(?:(Safari)\/([0-9]+(?:\.[0-9]+)?))/iu",$HUA, $matches)){ 
         }elseif(preg_match("/(?:(Netscape)(?:[0-9]*)\/([0-9]+(?:[\.0-9]+)?))/iu",$HUA, $matches)){ 
         }elseif(preg_match("/(?:(Firebird)\/([0-9]+(?:[\.0-9]+)?))/iu",$HUA, $matches)){ 
         }elseif(preg_match("/(?:(Debian)\/([0-9]+(?:[\.0-9-]+)?))/iu",$HUA, $matches)){ 
         }elseif(preg_match("/(?:(Galeon)\/([0-9]+(?:[\.0-9-]+)?))/iu",$HUA, $matches)){ 
         }elseif(preg_match("/(?:(Fedora)\/([0-9]+(?:[\.0-9-]+)?))/iu",$HUA, $matches)){ 
         }else return false; 
         list(,$f,$v)=$matches; 
         switch($type){ 
            case 'browser_family': return $f; break; 
            default: return $f.($v?' '.$v:''); break; 
         } 
   } return false; 
}
return "<b>OS</b>: ".HUA("os").", <b>Browser</b>: ".HUA("browser_family");

...

Napísané: Ut Jan 31, 2006 6:08 pm
od používateľa Kissman
funguje to sqele a i distro linuxu mi to naslo.. :) mam to zde

Kód: Vybrať všetko

http://www.pichrt.info/index.php?id=31