Go to Post Who needs weapons when you have a scary face - Conor Ryan [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 15-11-2002, 14:29
Jack's Avatar
Jack Jack is offline
FIRST Scouting Network
AKA: Andrew Schenk
FRC #0201 (The FEDS)
Team Role: Alumni
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Rochester Hills
Posts: 643
Jack is a jewel in the roughJack is a jewel in the roughJack is a jewel in the rough
Send a message via AIM to Jack
OS Stats

This is for Brandon, or anyone else that uses this.

How do (or vBulletin) get the stats for users OS? If you could post the php code that would be great, but if it is part of vB, then it might be copyrighted, but still could you describe what it uses.

PS: I mean how the data is receaved, not how the formatting for the stats page is.

Thanks
__________________
Team 201 - 2003 Great Lakes Semifinalists & 2003 Archimedes Division Finalists :|: Webmaster of www.feds201.com -> FBI Scouting
Winner of The 2003 ChiefDelphi Web Award for: User That Started The Most Non Chit Chat Threads
Winner of: 2003 FIRST Ventures with 5451.68 End Points

All about me: http://knehcsa.vze.com
**Check out the New FIRST Scouting Network**
  #2   Spotlight this post!  
Unread 15-11-2002, 14:41
rbayer's Avatar Unsung FIRST Hero
rbayer rbayer is offline
Blood, Sweat, and Code
no team (Teamless Orphan)
 
Join Date: Mar 2002
Rookie Year: 2001
Location: Minnetonka, MN
Posts: 1,087
rbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of lightrbayer is a glorious beacon of light
Send a message via AIM to rbayer
You can do it in javascript fairly easily. Just look at the navigator.appVersion object and look for the substring "Win" "Mac" "Linux" or "X11". I'm sure there are other possible values to check for, but these are the only ones I know of.
__________________
New C-based RoboEmu2 (code simulator) available at: http://www.robbayer.com/software.php
  #3   Spotlight this post!  
Unread 15-11-2002, 15:09
Brandon Martus's Avatar Unsung FIRST Hero
Brandon Martus Brandon Martus is offline
busy.
AKA: B. Slash Kamen
no team
 
Join Date: May 2001
Rookie Year: 1998
Location: Nevada, TX USA
Posts: 5,271
Brandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond reputeBrandon Martus has a reputation beyond repute
Send a message via ICQ to Brandon Martus Send a message via AIM to Brandon Martus Send a message via Yahoo to Brandon Martus
You can do it with javascript, yes.

If you want to record/handle it on server-side, however, you can use a few things in PHP.

To get the OS in our 'stats' section on chiefdelphi.com ... we use a vBulletin hack. Here is the code (yes, its ugly.. i didnt write it ):

Code:
if(ereg("Win", getenv("HTTP_USER_AGENT"))) $c_os = "Windows";
elseif((ereg("Mac", getenv("HTTP_USER_AGENT"))) || (ereg("PPC", getenv("HTTP_USER_AGENT")))) $c_os = "Mac";
elseif(ereg("Linux", getenv("HTTP_USER_AGENT"))) $c_os = "Linux";
elseif(ereg("FreeBSD", getenv("HTTP_USER_AGENT"))) $c_os = "FreeBSD";
elseif(ereg("SunOS", getenv("HTTP_USER_AGENT"))) $c_os = "SunOS";
elseif(ereg("IRIX", getenv("HTTP_USER_AGENT"))) $c_os = "IRIX";
elseif(ereg("BeOS", getenv("HTTP_USER_AGENT"))) $c_os = "BeOS";
elseif(ereg("OS/2", getenv("HTTP_USER_AGENT"))) $c_os = "OS/2";
elseif(ereg("AIX", getenv("HTTP_USER_AGENT"))) $c_os = "AIX";
else $c_os = "Other";
Then, $c_os will have the user's operating system.

And, ugly-coded browser detection:
Code:
if((ereg("Nav", getenv("HTTP_USER_AGENT"))) || (ereg("Gold", getenv("HTTP_USER_AGENT"))) || (ereg("X11", getenv("HTTP_USER_AGENT"))) || (ereg("Mozilla", getenv(
"HTTP_USER_AGENT"))) || (ereg("Netscape", getenv("HTTP_USER_AGENT"))) AND (!ereg("MSIE", getenv("HTTP_USER_AGENT")))) $c_browser = "Netscape";
elseif(ereg("MSIE", getenv("HTTP_USER_AGENT"))) $c_browser = "MSIE";
elseif(ereg("Lynx", getenv("HTTP_USER_AGENT"))) $c_browser = "Lynx";
elseif(ereg("Opera", getenv("HTTP_USER_AGENT"))) $c_browser = "Opera";
elseif(ereg("WebTV", getenv("HTTP_USER_AGENT"))) $c_browser = "WebTV";
elseif(ereg("Konqueror", getenv("HTTP_USER_AGENT"))) $c_browser = "Konqueror";
elseif((eregi("bot", getenv("HTTP_USER_AGENT"))) || (ereg("Google", getenv("HTTP_USER_AGENT"))) || (ereg("Slurp", getenv("HTTP_USER_AGENT"))) || (ereg("Scooter", getenv("HTTP_USER_AGENT"))) || (eregi("Spider", getenv("HTTP_USER_AGENT"))) || (eregi("Infoseek", getenv("HTTP_USER_AGENT")))) $c_browser = "Bot";
else $c_browser = "Other";
$c_browser has the browser in it.


And, another way .. you would make this script, load it in a browser, and see what happens:



The following example shows how one might list all available information retrieved about the user's browser.

Example 1. get_browser() example

Code:
<?php
function list_array ($array) {
    while (list ($key, $value) = each ($array)) {
    $str .= "<b>$key:</b> $value<br />\n";
    }
    return $str;
}
echo "$HTTP_USER_AGENT<hr />\n";
$browser = get_browser();
echo list_array ((array) $browser);
?>
The output of the above script would look something like this:

Code:
Mozilla/4.5 [en] (X11; U; Linux 2.2.9 i586)<hr />
<b>browser_name_pattern:</b> Mozilla/4\.5.*<br />
<b>parent:</b> Netscape 4.0<br />
<b>platform:</b> Unknown<br />
<b>majorver:</b> 4<br />
<b>minorver:</b> 5<br />
<b>browser:</b> Netscape<br />
<b>version:</b> 4<br />
<b>frames:</b> 1<br />
<b>tables:</b> 1<br />
<b>cookies:</b> 1<br />
<b>backgroundsounds:</b> <br />
<b>vbscript:</b> <br />
<b>javascript:</b> 1<br />
<b>javaapplets:</b> 1<br />
<b>activexcontrols:</b> <br />
<b>beta:</b> <br />
<b>crawler:</b> <br />
<b>authenticodeupdate:</b> <br />
<b>msn:</b> <br />
This, and discussion, can be found on the PHP manual: http://www.php.net/manual/en/function.get-browser.php
__________________
Brandon Martus
e-mail

Last edited by Brandon Martus : 15-11-2002 at 15:20.
  #4   Spotlight this post!  
Unread 15-11-2002, 17:48
Jack's Avatar
Jack Jack is offline
FIRST Scouting Network
AKA: Andrew Schenk
FRC #0201 (The FEDS)
Team Role: Alumni
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Rochester Hills
Posts: 643
Jack is a jewel in the roughJack is a jewel in the roughJack is a jewel in the rough
Send a message via AIM to Jack
Thanks
__________________
Team 201 - 2003 Great Lakes Semifinalists & 2003 Archimedes Division Finalists :|: Webmaster of www.feds201.com -> FBI Scouting
Winner of The 2003 ChiefDelphi Web Award for: User That Started The Most Non Chit Chat Threads
Winner of: 2003 FIRST Ventures with 5451.68 End Points

All about me: http://knehcsa.vze.com
**Check out the New FIRST Scouting Network**
  #5   Spotlight this post!  
Unread 16-11-2002, 10:35
Jeremy_Mc's Avatar
Jeremy_Mc Jeremy_Mc is offline
GitHubber
no team
Team Role: Mentor
 
Join Date: Feb 2002
Rookie Year: 2002
Location: Orlando, FL
Posts: 496
Jeremy_Mc will become famous soon enoughJeremy_Mc will become famous soon enough
e-mail me at jdmcanally@yahoo.com and i'll give you our stats script.

it grabs the browser and os and graphs it for you.

i'd show you a demo but i can't let you into our admin area haha.



later.
__________________
GitHub - Collaborate on code, documentation, etc. - http://github.com
  #6   Spotlight this post!  
Unread 16-11-2002, 11:34
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,557
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Now I see why the stats script puts Konqueror as Netscape. My user agent says Mozilla/5.0 (compatible; Konqueror/3.0.0-10; Linux; X11; i686; , en_US) which means that Konqueror is identified in the first line, it needs an and ! exception like MSIE.

It would also be nice to seperate Gecko based browsers (netscape 6,7, mozilla, galeon, etc.) from netscape 4 browsers. This would be easy to do by adding a Gecko exception to the first line, and then adding another elseif that looks for Gecko

DOH! I just checked the discussion in the PHP manual, and somebody had already done that (at least the Gekco detection)
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Florida Scoring Stats soap108 Regional Competitions 7 28-03-2003 07:10
Big Ball Stats? archiver 2001 3 24-06-2002 02:40
some scoring stats soap108 General Forum 6 16-04-2002 12:32
Drill motors stats Zac Louden Motors 1 14-01-2002 07:21
Bug on stats page Jay Lundy CD Forum Support 2 07-11-2001 05:02


All times are GMT -5. The time now is 01:44.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi