Environment Tests

Discussion in 'Web Design & Coding' started by Lighthater, Nov 20, 2002.

  1. Lighthater

    Lighthater Guest

    I know this may be a very broad question, but can anyone tell me how to create an environment test script? I might not even be calling it by the right name. Here is an example:

    http://pci.chadwyck.com/envtest.cgi

    A sample script would be ideal, but I will take anything I can get :D

    Thanks in advance for any help.
     
  2. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    Not sure i quite understand
    are you after the user info ?
     
  3. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    Thread Moved to Coding & Design
     
  4. Lighthater

    Lighthater Guest

    Yes, basically. I work in technical support and it is very helpful to know as much about the user as possible. We do an IP based authentication here, so knowing their IP is one thing I would want to capture. Also knowing information like OS, Browser, URL the user came from, etc would be very helpful. The example I posted is very close to what I want to have, but I just don't know who to do this.
     
  5. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    \o/ <o/ \o_ \o|

    Here you go then, i wrote this aaages ago and have found it useful ever since, it gathers user info via PHP and JavaScript...

    PHP:
    <!-- (c) SPeedY_B --><html><head>
    <title>User Info  </title>

    <style type="text/css">
    BODY {
    scrollbar-face-color: #ffffff;
    scrollbar-shadow-color: #FFFFFF;
    scrollbar-highlight-color: #FFFFFF;
    scrollbar-3dlight-color: #4A9FE0;
    scrollbar-darkshadow-color: #ffffff;
    scrollbar-track-color: #ffffff;
    scrollbar-arrow-color: #4A9FE0;
    }
    </style>
    </head><BODY onLoad="window.status='SPeedY_B ²ºº² '; return true;">
    <body bgcolor="#FFFFFF" link="#3366FF" vlink="#3366FF" alink="#3366FF">
    <font Face="Tahoma" color="#4A9FE0" size="2">
    <i>SPeedY_B ²ºº²</i>
    <hr color="#4A9FE0">
    <div align="center"><font Face="Tahoma" color="#4A9FE0" size="2"><U>User Info</u></div>
    <table align=center border=0>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">PHP Info:</td>
     <td></td>
    </tr>
    <? $ipaddr getenv("REMOTE_ADDR"); ?>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">IP Adress:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><?echo $ipaddr?></td>
    </tr><font Face="Tahoma" color="#4A9FE0" size="2">

    <?
    $what 
    gethostbyaddr($ipaddr);

    ?>

    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Host:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><?echo $what?></td>

    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Refering Page:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><?echo getenv("HTTP_REFERER"); ?></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Retreival Method:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><?echo getenv("REQUEST_METHOD"); ?></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Browser Accept:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><?echo getenv("HTTP_ACCEPT"); ?></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Server Protocol:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><?echo getenv("SERVER_PROTOCOL"); ?></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Browser Version:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><?echo getenv("HTTP_USER_AGENT"); ?></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Language:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><?echo getenv("HTTP_ACCEPT_LANGUAGE"); ?></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Port:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><?echo getenv("REMOTE_PORT"); ?></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Java Info:</td>
     <td></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Browser:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><Script>document.write(navigator.appName)</script></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Operating System:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><Script>document.write(navigator.platform)</script></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Resolution:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><Script>document.write(screen.width + " x " + screen.height)</script></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Colour Depth:</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><Script>document.write(screen.colorDepth + " bit")</script></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Java Enabled?</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><script language="JavaScript">
            if(navigator.javaEnabled()){document.write("Yup")}
            else{document.write("Nope")}
         </script></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Anti-aliasing ?</td>
     <td><font Face="Tahoma" color="#4A9FE0" size="2"><script language="JavaScript">
            if(window.screen.fontSmoothingEnabled == true){document.write("Yup")}
            else{document.write("Nope")}
         </script></td>
    </tr>
    <tr>
     <td><font Face="Tahoma" color="#4A9FE0" size="2">Plugins (Netscape):</td>
     <td></td>
    </tr>
    <font Face="Tahoma" color="#4A9FE0" size="2">
    <script language="JavaScript">
     for(i=0; i<navigator.plugins.length; i++){
       document.writeln("<tr>");
       document.writeln("<td colspan=2>" + navigator.plugins[i].name + "</td>");
       document.writeln("</tr>");
     }
    </script>
    </table>
    </BODY></HTML>
    Hope its of some help .....
     
  6. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    Here's an example of what it outputs when i use it via mozilla (yes, the user agnet is fake :) )

     
  7. Lighthater

    Lighthater Guest

    Whoa! Speedy, you have definately lived up to your name!
     
  8. SPeedY_B

    SPeedY_B I may actually be insane.

    Messages:
    15,800
    Location:
    Midlands, England
    heh, its something i had pre-prepared so to speak :D
    It was one of the first things i wanted to do when i first started using PHP over html, not that i've ever found any real implementation for it (other than blocking peons access to things :p ) but its always a handy file to have lurking about :D
     
  9. Lighthater

    Lighthater Guest

    Speedy, Thanks again for this. It was just what I was looking for! Just a few more tweaks/additions and I will be all set! You are King for a day (or longer if you like)!