[ciapug] Browser Strings

Dave J. Hala Jr. ciapug@cialug.org
Thu, 14 Oct 2004 13:00:12 -0500


Yeah, I've just made a bunch of tweaks to the code...

Basically what I'm gonna do is only let XP SP2 users, win2k with the
firefox or mozilla browsers, mac, linux users this particular site. If
they are running anything else, I'm gonna spit tons of messages at them
and limit the access.

I'm just not a nice person...

:) Dave

On Thu, 2004-10-14 at 12:03, Barry Von Ahsen wrote:
> You can check for XP SP2 also by searching for SV1 (I'm not sure which
> array element it would be in).  Useful for dealing with some of the
> "enhancements" they've made (like file downloads)
> 
> See the very bottom of:
> http://msdn.microsoft.com/security/default.aspx?pull=/library/en-us/dnwxp/html/xpsp2web.asp
> 
> -barry
> 
> 
> On Thu, Oct 14, 2004 at 09:19:44AM -0500, Dave J. Hala Jr. wrote:
> > So, I've been fooling around trying to identify the web browser, the os
> > and if $MS the patch level. I've tried on with Mozilla on RHEL WS 3.x,
> > windows 95/98 win2k and XP... 
> > 
> > It's a crude function that gets the basics:
> > 
> > 
> > function parse_id($browser_id)
> > {
> > #
> > # Almost always the good stuff starts at the right paren. Convert it
> > # into a semi-colon to make it easier to explode the string into an
> > array
> > $new_id = str_replace("(", ";", $browser_id);
> > # sometimes MS doesn't use the right paren in the id string, and they
> > add extra stuff,
> > # remember embrace and extend?
> > # convert the right paran to a semi colon if it exits
> > $new_id = str_replace(")", ";", $new_id);
> > #echo "New id: $new_id <BR>";
> > # explode the values into an array
> > $info = explode(";", $new_id);
> > $cnt = count($info);
> > # cleanup the elements
> > for ($i=0;$i<$cnt;$i++){ $info[$i] = ltrim(rtrim($info[$i]));}
> > # element # 2 in the array is the browser identity string.
> > # however, mozilla and firefox put a U in there.Firefox
> > # identifiers end up in the elements 4 and 5, mozilla in 4,5,6
> > if($info[2] == 'U'){ $info[2] = "$info[4] $info[5] $info[6]";}
> > # windows 95/98 are reported as Windows 95 or Windows 98
> > # However 2000/Xp are reported as NT 5.0 or NT 5.1
> > # so clean it up
> > if($info[3]== "Windows NT 5.0"){ $info[3] = "Windows 2000";}
> > if($info[3]== "Windows NT 5.1"){ $info[3] = "Windows XP";}
> > # print out the results
> > for ($i=0;$i<$cnt;$i++){ echo "$i: $info[$i] <BR> ";}
> > 
> > return($info);
> > 
> > }
> > 
> > If anyone has any comments or ideas, I'd appreciate some feedback.
> > 
> > Also here's an interesting link:
> > http://www.hyperborea.org/journal/archives/2004/06/19/whats-in-a-user-agent-string/
> > 
> > :) Dave
> > -- 
> > 
> > Open Source Information Systems (OSIS)
> > Dave J. Hala Jr. <dave@osis.us>
> > 641.485.1606
> > 
> > _______________________________________________
> > ciapug mailing list
> > ciapug@cialug.org
> > http://cialug.org/mailman/listinfo/ciapug
-- 

Open Source Information Systems (OSIS)
Dave J. Hala Jr. <dave@osis.us>
641.485.1606