User:Inge Hoonte/operating system detector

From XPUB & Lens-Based wiki
< User:Inge Hoonte
Revision as of 00:46, 4 November 2011 by Inge Hoonte (talk | contribs) (Created page with "<source lang="bash"> #!/usr/bin/python import os print "Content-type: image/jpg" print if "Linux" in os.environ['HTTP_USER_AGENT']: f=open("linux.jpg") print f...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
#!/usr/bin/python

import os
print "Content-type: image/jpg"
print

if "Linux" in os.environ['HTTP_USER_AGENT']:
        f=open("linux.jpg")
        print f.read()

elif "Mac" in os.environ['HTTP_USER_AGENT']:
        f=open("mac.jpg")
        print f.read()

elif "Windows" in os.environ['HTTP_USER_AGENT']:
        f=open("windows.jpg")
        print f.read()