/* Programmer: Traker International www.autotraker.com Purpose: to show all environmental variables on a web site Usage: compile and place into your cgi-bin directory http://www.yourwebsite.com/cgi-bin/GetEnv.exe Note: This program uses Windows Scripting host If you do not have it installed or do not have it available on your server, this program will not work. Your cgi-bin directory must be configured properly to execute programs. This program has only been tested using Apache, but there should be no problem using it on IIS. You must have dB2K 0.4 or better for the error routines. */ /* inorder to compile, use the commands below compile GetEnv.prg build GetEnv.pro to "ViewEnv.exe" web */ clear if "RUNTIME" $ upper(version(1)) _app.errorAction = 3 else _app.errorAction = 4 endif _app.errorLogFile = "EnvErrorLog.txt" _app.errorLogMaxSize = 2048 _app.allowYieldOnMsg = true // output file in case we are running from development outputfile = "enviro.html" // Create Shell Object to access environment variables shell = new OleAutoClient("WScript.Shell") // Create File Object to write to file. f = New File() if empty(getenv('SERVER_SOFTWARE')) f.create(outputfile, 'A') else f.open('StdOut', 'A') endif // Create 'collection' variables to hold each of the environments sys = shell.Environment( "SYSTEM" ) user = shell.Environment( "USER" ) proc = shell.Environment( "PROCESS" ) vol = shell.Environment( "VOLATILE" ) // Function call to write HTML header to output file writeHeader(f) // Function call to loop through and write out each // environment collection showEnvironment( sys, "SYSTEM", f, shell ) showEnvironment( proc, "PROCESS", f, shell ) showEnvironment( user, "USER", f, shell ) showEnvironment( vol, "VOLATILE", f, shell ) // Function call to write HTML footer writeFooter(f) // close the file object f.close() // clean up release object shell release object f release object sys release object user release object proc release object vol return function showEnvironment( obj, title, f , shell) // Function to loop through environment collection // obj - Collection variable that holds environment variables // title - title to write to HTML table // f = reference to file object // shell = reference to shell object // if the collection is empty, just return if empty(obj[0]) return endif // Write the start of our table f.puts( [
| ] )
f.puts( [ |