[thelist] known strings for cgi.http_user_agent

rudy r937 at interlog.com
Mon Feb 4 22:41:00 CST 2002


>any thoughts on an elegant way to do this would be useful :)

hi michael

you said this was for some kind of hit counter?

don't analyze the user agent string while serving up the page

just log it, and analyze later

if you're doing a hit counter by browser type, you're looking at maybe a
couple dozen rows (one per browser) but a lot of processing to figure out
which row to add 1 to

if you do it by user agent, however, you'll have several hundred rows
instead, but less processing as you serve up each page

pseudo-logic comes down to something like this

   select 'peekaboo' from hitcountertable
           where useragent = '#cgi.http_user_agent#'
   if recordcount=0
         insert into hitcountertable (useragent, hits)
             values ('#cgi.http_user_agent#', 1)
   else
         update hitcountertable
           set hits = hits + 1
           where useragent = '#cgi.http_user_agent#'


of course, i may have the wrong idea of what you're trying to do here...


rudy




More information about the thelist mailing list