Re: [PHP] Is there an easy way to divid up HTTP_USER_AGENT?
After A bit of research I wrote this(File is also attached in case e-mail programs/servers interfere with formatting): I seems to work quite well. -- JJ Harrison [EMAIL PROTECTED] www.tececo.com P.S. My proxy seems to interfere with the Weberdev site. If Boaz Yahav <[EMAIL PROTECTED]> or someone else wants to post this to Weberdev or any other similar site as long as it remains free/open source etc. "Jj Harrison" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Because! > > Also the audiance that will probably see the site will highly likely not > have the knowledge or intention to change the user agent var. So my Q > remains. > > To add to my original Q is there seperate vars for browser and OS? > > JJ Harrison > [EMAIL PROTECTED] > www.tececo.com > > "Alberto Serra" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED]... > > JJ Harrison wrote: > > > Is there an easy way to divide up $_SERVER['HTTP_USER_AGENT'] or do I > have > > > to use regular expressions(Which I have little experiance with)? > > > > Why would you want to use that? People write in their HTTP_USER_AGENT > > whatever they want to, and many times you'll find there a set of 4 > > letter words instead of the info you look for. There is a nice add-on > > for Mozilla to make that trick even easier. > > > > Alberto > > Kiev > > > > > > -- > > > > > > @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ > > > > LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? > > lOrD i'M sHiNiNg... > > YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE > > tHe TeSt, YeS iT iS > > ThE tEsT, yEs It Is > > tHe TeSt, YeS iT iS > > ThE tEsT, yEs It Is... > > > > begin 666 eregi.php M/#\-"B\O($)R;W=S97(@1&5T96-T:6]N#0H):68H(&5R96=I*"(H;W!ES$L,WTI>S L,7TB+"1?4T525D526R=(5%10 M7U5315)?04=%3E0G72PDS$L,GTN6S M.5U[,2PS?2E[,"PQ?2(L)%]315)615);)TA45%!?55-%4E]! M1T5.5"==+"1R96=S*2E[)&)R;W=S97(@/2 B3W!ER1BR1BR1BS$L,GTN6S M.5U[,2PR?2DB+"1?4T525D526R=(5%107U5315)?04=%3E0G M72PD6YX("1R96=S6S)=(CM]#0H)96QS M96EF*"!ES$L,WTI M(BPD7U-%4E9%4ELG2%144%]54T527T%'14Y4)UTL)')E9W,I("E[)&)R;W=S M97(@/2 B3&EN:W,@)')E9W-;,ETB.WT-"@EE;'-E:68H(&5R96=I*"(H;7-I M92D@*%LP+3E=>S$L,GTN6S M.5U[,2PS?2DB+"1?4T525D526R=(5%107U53 M15)?04=%3E0G72PDFEL M;&$I+RA;,"TY77LQ+#)]+ELP+3E=>S$L,WTI(BPD7U-%4E9%4ELG2%144%]5 M4T527T%'14Y4)UTL)')E9W,I("E[)&)R;W=S97(@/2 B3F5TR1B MR1S>7-T96T@/2 B3&[EMAIL PROTECTED]"@EE;'-E:68H97)E9VDH(G=I;C,R(BPD M7U-%4E9%4ELG2%144%]54T527T%'14Y4)UTI*7LD" T+CDP(BPD7U-%4E9%4ELG M2%144%]54T527T%'14Y4)UTI*7LDR1S>7-T96T@ M/2 B5VEN9&]WS$L,GTI>S L,7TB+"1?4T525D526R=(5%10 M7U5315)?04=%3E0G72PDS$L,GTN6S M.5U[,2PR?2E[,"PQ?2(L)%]315)615);)TA4 M5%!?55-%4E]!1T5.5"==+"1R96=S*2 I>R1S>7-T96T@/2 B5VEN9&]WS$L,GTI>S L,7TB+"1?4T525D52 M6R=(5%107U5315)?04=%3E0G72PDR1S>7-T96T@/2 B0F5/4R D MR1S>7-T96T@ M/2 B25))6"([?0T*"65L"(L)%]3 M15)615);)TA45%!?55-%4E]!1T5.5"==*2!\?"!ER1S>7-T96T@/2 B56YI>"([ M?0T*"65L7-T96T@http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there an easy way to divid up HTTP_USER_AGENT?
ðÒÉ×ÅÔ! > Because! LOLOL okay. You can use this javascript stuff, it's more accurate and does not get fooled by the rubbish people write in their user_agents // This function attempts to determine visitor's spoken language // function browser_language() { if (navigator.appName == 'Netscape') var language = navigator.language; else var language = navigator.browserLanguage; return language; } // This function states whether browser is java_enabled // function java_enabled() { // Find whether java is here if (navigator.javaEnabled() == 1) return "Y"; else return "N"; } // This function states whether browser is font smoothing capable // function fontSmoothing_enabled() { // Find whether fonts smoothing available if (window.screen.fontSmoothingEnabled == true) return "Y"; else return "N"; } // This function is used to generate the SRC parameter for the iframe // in order to pass it all estracted parameters on clients workstation // without using cookies // function launch() { window.onerror=null; document.location = "somescript.php?"+ "language="+ browser_language() +"&"+ "screen="+ window.screen.width+"x"+window.screen.height +"&"+ "screenavailable="+ window.screen.availWidth+"x"+window.screen.availHeight +"&"+ "colours="+ window.screen.colorDepth +"&"+ "fonts_smoothing="+ fontSmoothing_enabled() +"&"+ "java="+ java_enabled() +"&"+ "browser="+ navigator.appName +"&"+ "version="+ navigator.appVersion +"&"+ "mozilla="+ navigator.appCodeName +"&"+ "os="+ navigator.platform +"&"+ "ref="+ document.referrer; ÐÏËÁ áÌØÂÅÒÔÏ ëÉÅ× -- @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? lOrD i'M sHiNiNg... YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE tHe TeSt, YeS iT iS ThE tEsT, yEs It Is tHe TeSt, YeS iT iS ThE tEsT, yEs It Is... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there an easy way to divid up HTTP_USER_AGENT?
JJ, I don't know of an *easy* way, but this script (with regex's ) isn't too bad; you can figure it out with a little bit of research. /* begin script ereg("^([[:alpha:]]+)/([[:digit:]\.]+)( .*)$", $HTTP_USER_AGENT, $match); $Browser_Name=$match[1]; $Browser_Version=$match[2]; $Browser_Description=$match[3]; If(eregi("msie", $Browser_Description)) eregi("MSIE ([[:digit:]\.]+);, $Browser_Description, $match); $Browser_Name="MSIE"; $Browser_Version = $match[1]; } // end script */ So now, you have a script which gets the Name, Version and Description, and also looks to specify MSIE as the browser. Read up on Regular Expressions, and you can modify this for any browser/version combo. (adopted from Listing 16.3 in Core PHP Programming by Leon Atkinson) -- Chris Garaffa #!/usr/local/lib/php $contact_info["Name"] = "Chris Garaffa"; $contact_info["Email"] = "[EMAIL PROTECTED]"; $contact_info["Work"] = "[EMAIL PROTECTED]"; $contact_info["cell"] = "203.803.9066"; He who calles himself "JJ Harrison" (from <[EMAIL PROTECTED]>) wrote on 7/5/02 10:25 AM: > Because! > > Also the audiance that will probably see the site will highly likely not > have the knowledge or intention to change the user agent var. So my Q > remains. > > To add to my original Q is there seperate vars for browser and OS? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there an easy way to divid up HTTP_USER_AGENT?
Hi As far as I can see you need to manipulate HTTP_USER_AGENT yourself. Here is an example that I used to determine if the browser is MSIE and if so what version it is. What are you trying to determine? A specific browser? if (strStr($HTTP_USER_AGENT, "MSIE")) { $agent_array = split(";", $HTTP_USER_AGENT); $ie_version = subStr($agent_array[1], 6,7); } Regards John - Original Message - From: "JJ Harrison" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, July 05, 2002 3:25 PM Subject: Re: [PHP] Is there an easy way to divid up HTTP_USER_AGENT? > Because! > > Also the audiance that will probably see the site will highly likely not > have the knowledge or intention to change the user agent var. So my Q > remains. > > To add to my original Q is there seperate vars for browser and OS? > > JJ Harrison > [EMAIL PROTECTED] > www.tececo.com > > "Alberto Serra" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED]... > > JJ Harrison wrote: > > > Is there an easy way to divide up $_SERVER['HTTP_USER_AGENT'] or do I > have > > > to use regular expressions(Which I have little experiance with)? > > > > Why would you want to use that? People write in their HTTP_USER_AGENT > > whatever they want to, and many times you'll find there a set of 4 > > letter words instead of the info you look for. There is a nice add-on > > for Mozilla to make that trick even easier. > > > > Alberto > > Kiev > > > > > > -- > > > > > > @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ > > > > LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? > > lOrD i'M sHiNiNg... > > YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE > > tHe TeSt, YeS iT iS > > ThE tEsT, yEs It Is > > tHe TeSt, YeS iT iS > > ThE tEsT, yEs It Is... > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is there an easy way to divid up HTTP_USER_AGENT?
Because! Also the audiance that will probably see the site will highly likely not have the knowledge or intention to change the user agent var. So my Q remains. To add to my original Q is there seperate vars for browser and OS? JJ Harrison [EMAIL PROTECTED] www.tececo.com "Alberto Serra" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > JJ Harrison wrote: > > Is there an easy way to divide up $_SERVER['HTTP_USER_AGENT'] or do I have > > to use regular expressions(Which I have little experiance with)? > > Why would you want to use that? People write in their HTTP_USER_AGENT > whatever they want to, and many times you'll find there a set of 4 > letter words instead of the info you look for. There is a nice add-on > for Mozilla to make that trick even easier. > > Alberto > Kiev > > > -- > > > @-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@-_=}{=_-@ > > LoRd, CaN yOu HeAr Me, LiKe I'm HeArInG yOu? > lOrD i'M sHiNiNg... > YoU kNoW I AlMoSt LoSt My MiNd, BuT nOw I'm HoMe AnD fReE > tHe TeSt, YeS iT iS > ThE tEsT, yEs It Is > tHe TeSt, YeS iT iS > ThE tEsT, yEs It Is... > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php