Typu Browseru & OS

V tejto téme sa nachádzajú snippety (rozšírenia) pre Etomite.

Moderátor: Moderators

Kissman
Light Expert
Light Expert
Príspevky: 42
Dátum registrácie: Ut Nov 08, 2005 7:24 pm

Typu Browseru & OS

Príspevok 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.
Používateľov profilový obrázok
_rasel^
ETOMITE Admin
ETOMITE Admin
Príspevky: 1122
Dátum registrácie: Ut Sep 20, 2005 1:03 am
Bydlisko: Košice (SR)
Kontaktovať používateľa:

Príspevok 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
..:: Etomite CMS → Rulezzz !.!.!. ::..
Používateľov profilový obrázok
grabo
Expert
Expert
Príspevky: 145
Dátum registrácie: Pi Sep 23, 2005 6:57 pm
Bydlisko: Krh.
Kontaktovať používateľa:

Príspevok 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
Máš problém? Bloguj!
Používateľov profilový obrázok
_rasel^
ETOMITE Admin
ETOMITE Admin
Príspevky: 1122
Dátum registrácie: Ut Sep 20, 2005 1:03 am
Bydlisko: Košice (SR)
Kontaktovať používateľa:

Príspevok od používateľa _rasel^ »

2 grabo: Thx...
..:: Etomite CMS → Rulezzz !.!.!. ::..
Kissman
Light Expert
Light Expert
Príspevky: 42
Dátum registrácie: Ut Nov 08, 2005 7:24 pm

..

Príspevok od používateľa Kissman »

jj.. je to supr.. diky
Kissman
Light Expert
Light Expert
Príspevky: 42
Dátum registrácie: Ut Nov 08, 2005 7:24 pm

...

Príspevok 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");
}
Používateľov profilový obrázok
_rasel^
ETOMITE Admin
ETOMITE Admin
Príspevky: 1122
Dátum registrácie: Ut Sep 20, 2005 1:03 am
Bydlisko: Košice (SR)
Kontaktovať používateľa:

Príspevok 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");
..:: Etomite CMS → Rulezzz !.!.!. ::..
Kissman
Light Expert
Light Expert
Príspevky: 42
Dátum registrácie: Ut Nov 08, 2005 7:24 pm

...

Príspevok 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
Napísať odpoveď