[Zope] Finding out what Operating System a site visitor is using

Alan C alanc@tech-world.com
Thu, 13 Sep 2001 19:48:30 -0500


My system doesn't use IIS, and doesn't show the OS variable.
It does also lock up on <dtml-var OS>.
I'd suspect OS is a reserved word or in use variable conflict.

Most of your REQUEST is coming from IIS instead of Zope which I find
interesting.

If you are willing to consider a javascript solution,
http://developer.netscape.com/docs/manuals/js/client/jsref/nav.htm#1193137

<script>
document.write("The value of navigator.platform is " +
   navigator.platform)
</script>

You can get a more specific OS version from the browser string, but the
format will change.
HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
HTTP_USER_AGENT Mozilla/4.77 [en] (Windows NT 5.0; U)

<dtml-var HTTP_USER_AGENT>

So, search this for the known strings:

<HTML>
<BODY>
<dtml-if "_.string.rfind(HTTP_USER_AGENT, 'Windows NT 5.0')>0">
You are running Windows 2000, which used to be called NT 5.0<BR>
before the Microsoft Marketing weenies got to it.<BR>
<dtml-else>

<dtml-if "_.string.rfind(HTTP_USER_AGENT, 'Windows NT')>0">
You are running Windows NT 4.0, which is more stable than Windows 2000.<BR>
Don't believe it? Plug a 40ft USB cable into your port.<BR>
<dtml-else>
You are running something other than WinNT 4 or 5.<BR>
Your browser says: <dtml-var HTTP_USER_AGENT><BR>
</dtml-if>

</dtml-if>
</BODY>
</HTML>




> -----Original Message-----
> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> Steven Grimes
> Sent: Wednesday, September 12, 2001 7:46 PM
> To: Gregg Hartling
> Cc: Zope
> Subject: RE: [Zope] Finding out what Operating System a site visitor is
> using
>
>
> Greg,
>
> When I try this code it doesn't display anything. On the plus side this
> doesn't crash with a key error. Below I've included a portion of
> my REQUEST
> object for the page. As you can see it includes a value for OS but, when I
> try to access it I get a keyerror.
>
> environ
> USERPROFILE C:\WINNT\Profiles\Default User
> HTTP_ACCEPT_ENCODING gzip, deflate
> OS Windows_NT
> SERVER_PORT_SECURE 1
> LIB
> PROCESSOR_LEVEL 6
> HTTPS_KEYSIZE 128
> SCRIPT_NAME /scripts/zope.pcgi
> NUMBER_OF_PROCESSORS 1
> REMOTE_HOST 208.239.168.119
> HTTP_ACCEPT_LANGUAGE en-us
> PCGI_PUBLISHER
> GATEWAY_INTERFACE CGI/1.1
> ComSpec
> PCGI_DISPLAY_ERRORS 1
> HTTP_ACCEPT image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
> application/vnd.ms-excel, application/msword, */*
> INCLUDE
> SystemRoot C:\WINNT
> HTTPS on
> HTTP_HOST
> PCGI_PID_FILE C:\Progra~1\ATIAnywhere\pcgi\pcgi.pid
> PCGI_MODULE_PATH C:\Progra~1\ATIAnywhere\lib\python\Main.py
> HTTPS_SECRETKEYSIZE 1024
> BOBO_REALM Zope
> BOBO_DEBUG_MODE 1
> HTTPS_SERVER_SUBJECT C=US, S=Alabama, L=Mobile, O=Accelerated Technology,
> OU=dbase, OU=Terms of use at www.verisign.com/rpa (c)00,
> CN=legacydev.atinucleus.com
> PCGI_ERROR_LOG C:\Progra~1\ATIAnywhere\pcgi\pcgi.log
> Os2LibPath C:\WINNT\system32\os2\dll;
> PCGI_NAME Anywhere
> Path
> SERVER_PORT 443
> PATH_TRANSLATED
> INSTANCE_HOME
> INSTANCE_ID 1
> PROCESSOR_ARCHITECTURE x86
> REMOTE_ADDR
> SERVER_NAME
> HTTP_CONNECTION Keep-Alive
> HTTP_USER_AGENT Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)
> PCGI_PORT 8090
> windir C:\WINNT
> CONTENT_LENGTH 0
> SERVER_PROTOCOL HTTP/1.1
> PROCESSOR_REVISION 0502
> PATH_INFO /Testing/steven/OSTest
> REQUEST_METHOD GET
> PROCESSOR_IDENTIFIER x86 Family 6 Model 5 Stepping 2, GenuineIntel
> LOCAL_ADDR 208.239.168.53
> PCGI_SOCKET_FILE
> SERVER_SOFTWARE Microsoft-IIS/4.0
> SystemDrive C:
> PCGI_EXE
> HTTP_COOKIE tree-s="eJzTiFZ3hANPW/VYHU0ALlYElA"; dtpref_rows="20";
> dtpref_cols="100"; sql_pref__rows="15"; sql_pref__cols="100"
> PCGI_INFO_FILE C:\InetPub\scripts\zope.pcgi
> HTTPS_SERVER_ISSUER C=US, O="RSA Data Security, Inc.", OU=Secure Server
> Certification Authority
> COMPUTERNAME LEGACYDEV
>
>
> Thanks,
> Steven Grimes
> Database Engineer
> sgrimes@atinucleus.com <mailto:sgrimes@atinucleus.com>
>
> Accelerated Technology, Inc.
> 720 Oak Circle Drive East
> Mobile, AL 36609
> TEL*: 251-661-5770
> FAX*: 251-661-5788
> www.acceleratedtechnology.com <http://www.acceleratedtechnology.com>
> *Please note new area code "251"
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Over Ten Years of Providing Embedded Solutions
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>
> -----Original Message-----
> From: Gregg Hartling [mailto:hartling@earthlink.net]
> Sent: Wednesday, September 12, 2001 7:25 PM
> To: sgrimes@atinucleus.com
> Cc: Zope
> Subject: Re: [Zope] Finding out what Operating System a site visitor is
> using
>
>
> On Wednesday, September 12, 2001, at 05:14 PM, Steven Grimes wrote:
>
> > I need to find out what operating system my clients are using. I know
> > this information is available in the REQUEST object but I can not find
> > a way to print that information on a page.
> >  
> > For example:
> >  
> > <html>
> > <body>
> > Hello <dtml-var AUTHENTICATED_USER>! You are running {Operating System}.
> > </body>
> > </html>
> >  
> > Iwould like the Zope syntax to print the actual operating system used
> > in the statement above.
> >  
>
> <dtml-var "REQUEST['HTTP_UA_OS']"> works for me.
>
> Sticking <dtml-var REQUEST> into a DTML Method does a nice job of
> displaying the data available to you. I put a viewRequest method
> containing that tag in my root and reference it frequently.
>
> Gregg.
> --
> Gregg Hartling
> hartling@earthlink.net
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>