Respuesta: [Aporte] Detectar Navegador, Versión y Sistema Operativo Cita:
Iniciado por NSD mmmm he tenido problemas al usar tu funcion convertida, espero me disculpes por poner en tu tema mi funcion, pero lo ago para no repetir temas, ademas creo que la encotraran provechosa, detecta todo tipo de visitantes, si algun tipo no les iteresa pueden eliminar la categoria y ahorrar velocidad, funciona testeada en chrome ie firefox safari opera dragon rockmeit que son todos lo que tengo instalados pero intuyo que funcionara para todosXD espero les sirva:
Código PHP:
Ver originalFunction ObtenerNavegador($Agente) { $AgentesSoportados = Array( 'Robots' => Array('008','abachobot','accoona-ai-agent','addsugarspiderbot','anyapexbot','arachmo','b-l-i-t-z-b-o-t','baiduspider','becomebot','beslistbot','billybobbot','bimbot','bingbot','blitzbot','boitho.com-dc','boitho.com-robot','btbot','catchbot','cerberiandrtrs','charlotte','converacrawler','cosmos','covarioids','dataparksearch','diamondbot','discobot','dotbot','earthcom.info','emeraldshield.comwebbot','envolk[its]spider','esperanzabot','exabot','fastenterprisecrawler','fast-webcrawler','fdserobot','findlinks','furlbot','fyberspider','g2crawler','gaisbot','galaxybot','geniebot','gigabot','girafabot','googlebot','googlebot-image','gurujibot','happyfunbot','hl_ftien_spider','holmes','htdig','iaskspider','ia_archiver','iccrawler','ichiro','igdespyder','irlbot','issuecrawler','jaxifiedbot','jyxobot','koepabot','l.webis','lapozzbot','larbin','ldspider','lexxebot','lingueebot','linkwalker','lmspider','lwp-trivial','mabontland','magpie-crawler','mediapartners-google','mj12bot','mlbot','mnogosearch','mogimogi','mojeekbot','moreoverbot','morningpaper','msnbot','msrbot','mvaclient','mxbot','netresearchserver','netseercrawler','newsgator','ng-search','nicebot','noxtrumbot','nusearchspider','nutchcvs','nymesis','obot','oegp','omgilibot','omniexplorer_bot','oozbot','orbiter','pagebiteshyperbot','peew','polybot','pompos','postpost','psbot','pycurl','qseero','radian6','rampybot','rufusbot','sandcrawler','sbider','scoutjet','scrubby','searchsight','seekbot','semanticdiscovery','sensiswebcrawler','seochat::bot','seznambot','shim-crawler','shopwiki','shoularobot','silk','sitebot','snappy','sogouspider','sosospider','speedyspider','sqworm','stackrambler','suggybot','surveybot','synoobot','teoma','terrawizbot','thesubot','thumbnail.czrobot','tineye','truwogps','turnitinbot','tweetedtimesbot','twengabot','updated','urlfilebot','vagabondo','voilabot','vortex','voyager','vyu2','webcollage','websquash.com','wf84','wofindeichrobot','womlpefactory','xaldon_webspider','yacy','yahoo!slurp','yahoo!slurpchina','yahooseeker','yahooseeker-testing','yandexbot','yandeximages','yandexmetrika','yasaklibot','yeti','yodaobot','yooglifetchagent','youdaobot','zao','zealbot','zspider','zyborg'), 'Navegadores' => Array('abrowse','acoobrowser','americaonlinebrowser','amigavoyager','aol','arora','avantbrowser','beonex','bonecho','browzar','camino','charon','cheshire','chimera','chrome','chromeplus','classilla','cometbird','comodo_dragon','conkeror','crazybrowser','cyberdog','deepnetexplorer','deskbrowse','dillo','dooble','elementbrowser','elinks','enigmabrowser','enigmafox','epiphany','escape','firebird','firefox','firewebnavigator','flock','fluid','galaxy','galeon','granparadiso','greenbrowser','hana','hotjava','ibmwebexplorer','ibrowse','icab','iceape','icecat','iceweasel','inetbrowser','internetexplorer','irider','iron','k-meleon','k-ninja','kapiko','kazehakase','kindlebrowser','kkman','kmlite','konqueror','leechcraft','links','lobo','lolifox','lorentz','lunascape','lynx','madfox','maxthon','midori','minefield','mozilla','myibrow','myie2','namoroka','navscape','ncsa_mosaic','netnewswire','netpositive','netscape','netsurf','omniweb','opera','orca','oregano','osb-browser','palemoon','phoenix','pogo','prism','qtwebinternetbrowser','rekonq','retawq','rockmelt','safari','seamonkey','shiira','shiretoko','sleipnir','slimbrowser','stainless','sundance','sunrise','surf','sylera','tencenttraveler','tenfourfox','theworldbrowser','uzbl','vimprobable','vonkeror','w3m','weltweitimnetzbrowser','worldwideweb','wyzo'), 'Mobiles'=>Array('androidwebkitbrowser','blackberry','blazer','bolt','browserfors60','doris','dorothy','fennec','gobrowser','iemobile','iris','maemobrowser','mib','minimo','netfront','operamini','operamobile','semc-browser','skyfire','teashark','teleca-obigo','uzardweb'), 'Consolas' => Array('bunjalloo','playstation3','playstationportable','wii'), 'NavegadoresOffLine' => Array('offlineexplorer','superbot','webdownloader','webcopier','webzip','wget'), 'ClientesMail' => Array('Thunderbird'), 'LinkChecker' => Array('abilogicbot','linkvalet','linkvaliditycheck','linkexaminer','linksmanager.com_bot','mojoorobot','notifixious','onlinelinkvalidator','ploetz+zeller','reciprocallinksystempro','rellinkcheckerlite','sitebar','vivantelinkchecker','w3c-checklink','xenulinksleuth'), 'ColectoresMail' => Array('emailsiphon'), 'Validadores' => Array('csehtmlvalidator','csscheck','cynthia','htmlparser','p3pvalidator','w3c_css_validator_jfouffa','w3c_validator','wdg_validator'), 'Feed' => Array('awasu','bloglines','everyfeed-spider','feedfetcher-google','greatnews','gregarius','magpierss','nfreader','universalfeedparser'), 'Librerias' => Array('binget','curl','java','libwww-perl','microsofturlcontrol','peach','php','pxyscand','pycurl','python-urllib'), 'PlataformasEnNube' => Array('appengine-google'), 'Otros' => Array('!susie','amaya','cocoal.icio.us','domainsdb.netmetacrawler','gpodder','gsitecrawler','itunes','lftp','metauri','mt-newswatcher ','nitropdf','snoopy','urd-magpie','webcapture','windows-media-player') ); $Cliente['NOM']='modelo fuera de serie'; $Cliente['CAT']='dispositivo'; Foreach($AgentesSoportados As $Nombre => $Categoria){ Foreach($Categoria As $Navegador){ If(StriStr($Agente,$Navegador)) { $Cliente['NOM']=$Navegador; $Cliente['CAT']=$Nombre; Break; } } If($Cliente['CAT']!='dispositivo'){ Break; } } Return($Cliente); } $Visitante = ObtenerNavegador($_SERVER['HTTP_USER_AGENT']); Echo('Estas usando un: '.$Visitante['CAT'].' y es '.$Visitante['NOM'].' lo se todo sobre ti ;).');
Por cierto los nombres los saque de aqui: http://www.useragentstring.com/pages...gentstring.php y las versiones de los navegadores ? |