PDA

View Full Version : Stupid question, but I'll ask anyways


linux-tech
05-10-04, 12:59 PM
Here's what I'm looking for, I don't know if such a beast exists, but if it does, I'd be much appreciative if someone could post a link.

Currently, one of my projects calls for a counter, something to obtain information such as os, page, browser etc. Through php, I figured the best way to do this was something like this:


if(ereg("Win", getenv("HTTP_USER_AGENT"))) $os = "Windows";
elseif((ereg("Mac", getenv("HTTP_USER_AGENT"))) || (ereg("PPC", getenv("HTTP_USER_AGENT")))) $os = "Mac";
elseif(ereg("Linux", getenv("HTTP_USER_AGENT"))) $os = "Linux";
elseif(ereg("FreeBSD", getenv("HTTP_USER_AGENT"))) $os = "FreeBSD";
elseif(ereg("SunOS", getenv("HTTP_USER_AGENT"))) $os = "SunOS";
elseif(ereg("IRIX", getenv("HTTP_USER_AGENT"))) $os = "IRIX";
elseif(ereg("BeOS", getenv("HTTP_USER_AGENT"))) $os = "BeOS";
elseif(ereg("OS/2", getenv("HTTP_USER_AGENT"))) $os = "OS/2";
elseif(ereg("AIX", getenv("HTTP_USER_AGENT"))) $os = "AIX";
else $os = "Other";


The problem I'm running into right now is that I've got a lot of "other" browsers and "other" OS'es. Is there a site out there that lists what the possible user_agents are (such as AIX, Linux, etc, and the browsers as well)? Tried google, didn't have much luck, maybe I'm not putting in the right search terms.

projo
05-10-04, 01:31 PM
Like this:
http://www.psychedelix.com/agents.html

linux-tech
05-10-04, 01:52 PM
Exactly what I was lookin for. Know one for OS stuff? It seems that's the one that's hit the hardest.