Old October 18th, 2006, 14:31   #1
Darko
Pro Member
 
Darko's Avatar
 
Join Date: Jul 2005
Location: freewebspace.net\forums
Posts: 309
Darko has disabled reputation
Get Client Info

while testing ($_SERVER['HTTP_USER_AGENT'] predefined variable, to get some client info, i got some weird result,
on firefox i got:
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8) Gecko/20051111 Firefox/1.5

on opera i got:
Opera/9.00 (Windows NT 5.1; U; en)

on IE 7:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Avant Browser; FDM; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

what does mozilla has to do with MS IE 7
----------------------------------------------------------------------------

Another thing, i used get_broswer to get the platform, and it worked fine on the server, but apparently one of my clients host is blocking it. is there anyway to get the os without using get_broswer
Darko is offline   Reply With Quote
Old October 18th, 2006, 15:14   #2
krakjoe
stop staring
 
krakjoe's Avatar
 
Join Date: May 2006
Location: http://interviolet.com
Posts: 3,606
krakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to behold
same for ie6, and has been for a couple of version now, not sure exactly why, but u see there ie identifies as MSIE and always has.

perhaps someone else knows the reason, for as long as I can remember it's been that way
__________________
(\__/) Joe Watkins
(='.'=) PHP Programmer
(")_(") http://interviolet.com
Copy and paste bunny into your sig, help him gain world domination.
krakjoe is offline   Reply With Quote
Old October 19th, 2006, 10:56   #3
Darko
Pro Member
 
Darko's Avatar
 
Join Date: Jul 2005
Location: freewebspace.net\forums
Posts: 309
Darko has disabled reputation
so do you know, of anyway to get the client operating system, without using get_browser
Darko is offline   Reply With Quote
Old October 19th, 2006, 11:32   #4
krakjoe
stop staring
 
krakjoe's Avatar
 
Join Date: May 2006
Location: http://interviolet.com
Posts: 3,606
krakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to beholdkrakjoe is a splendid one to behold
theres not a fool proof way, best I can think of is

PHP Code:
<?php
if (stripos($_SERVER['HTTP_USER_AGENT'], 'win') !== FALSE) {
echo 
"Windows environment";
} else {
echo 
"clever boy";
}
?>
__________________
(\__/) Joe Watkins
(='.'=) PHP Programmer
(")_(") http://interviolet.com
Copy and paste bunny into your sig, help him gain world domination.
krakjoe is offline   Reply With Quote
Old October 19th, 2006, 12:45   #5
Mentok
Sup, Recoil here.
 
Mentok's Avatar
 
Join Date: Jun 2005
Location: Uzbekistan
Posts: 8,416
Mentok has a reputation beyond reputeMentok has a reputation beyond reputeMentok has a reputation beyond reputeMentok has a reputation beyond reputeMentok has a reputation beyond reputeMentok has a reputation beyond reputeMentok has a reputation beyond reputeMentok has a reputation beyond reputeMentok has a reputation beyond reputeMentok has a reputation beyond reputeMentok has a reputation beyond repute
I think IE6/7 is based on the Mozilla framework.. at least that's the only explanation I can think of.

http://www.siteware.ch/webresources/useragents/db.html is a pretty useful resource.
Mentok is offline   Reply With Quote
Old October 19th, 2006, 13:53   #6
Darko
Pro Member
 
Darko's Avatar
 
Join Date: Jul 2005
Location: freewebspace.net\forums
Posts: 309
Darko has disabled reputation
Quote:
Originally Posted by KRAK_JOE View Post
theres not a fool proof way, best I can think of is

PHP Code:
<?php
if (stripos($_SERVER['HTTP_USER_AGENT'], 'win') !== FALSE) {
echo 
"Windows environment";
} else {
echo 
"clever boy";
}
?>
i made something very similar to that, but it's not very accurate, i need something like the one that they use in webaliser, do you know of any javascript code that can do it
Darko is offline   Reply With Quote
Old October 23rd, 2006, 07:27   #7
Darko
Pro Member
 
Darko's Avatar
 
Join Date: Jul 2005
Location: freewebspace.net\forums
Posts: 309
Darko has disabled reputation
ok, so i found the script in the manual, and it's somewhat similar to what KRAK_JOE came up with:


$curos=strtolower($_SERVER['HTTP_USER_AGENT']);
if (strstr($curos,"mac")) {
$uos="MacOS";
} else if (strstr($curos,"linux")) {
$uos="Linux";
} else if (strstr($curos,"win")) {
$uos="Windows";
} else if (strstr($curos,"bsd")) {
$uos="BSD";
} else if (strstr($curos,"qnx")) {
$uos="QNX";
} else if (strstr($curos,"sun")) {
$uos="SunOS";
} else if (strstr($curos,"solaris")) {
$uos="Solaris";
} else if (strstr($curos,"irix")) {
$uos="IRIX";
} else if (strstr($curos,"aix")) {
$uos="AIX";
} else if (strstr($curos,"unix")) {
$uos="Unix";
} else if (strstr($curos,"amiga")) {
$uos="Amiga";
} else if (strstr($curos,"os/2")) {
$uos="OS/2";
} else if (strstr($curos,"beos")) {
$uos="BeOS";
} else
{ $uos="Unknown OS";
}

i just thought i put here, so if anybody in the future might needed, it will be on FWS

And if someone is intersted in developing it,, even more, here's a list of what HTTP_USER_AGENT might come back with:
http://www.siteware.ch/webresources/.../db.html#other

Regards
Darko
Darko is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


                                                       
  
  Free webhosting | News | Search free hosts | Free file hosting · Free image hosting | Forums | Advertising Info | Contact Us


        Copyright © 1996-2009 Per Olof Sandholm. All rights reserved. Privacy Statement

All times are GMT -5. The time now is 13:20.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright © 1996-2009 Per Olof Sandholm