#!/usr/bin/perl use IPC::Open2; print "Content-type: text/html\n\n"; require 'printdisplay.pl'; require 'generalinfo.pl'; require 'parseform.pl'; require 'errors.pl'; require 'password.pl'; require 'ordercontrol.pl'; require 'printmap.pl'; require 'callprogs.pl'; $gnuplot = '/usr/local/bin/gnuplot'; # path to gnuplot utility $ppmtogif = '/usr/local/bin/ppmtogif'; # path to ppmtogif utility $cprog = 'a.out'; # the program that runs the model $datafile = 'datafile'; # Login/Password/order file $script = "riverweb.cgi"; #Title of this script $domain = '/~kruyter/'; #baseDirectory $html = 'ncsa/html'; # dir html help files are stored in $databasedir = 'ncsa/'; # dir data is stored in if ($ENV{'QUERY_STRING'}){ &ParseQuery; $method = "query"; # user calls script from map page: query string info # - need to return form page if ($query{'map'}){ $method = "map"; &PrintForm; } # user calls script from form page link to make an improvement: query string info # - need to change order and return improved graphics elsif ($query{'improvement'}){ $user = $query{'user'}; ReadDatabase(); IdentifyOrder(); AddStationToOrder($query{'improvement'}); UpdateOrderInDatabase(); PrintArrayToDatabase(); PrintForm(); } elsif ($query{'retract'}){ $user = $query{'user'}; ReadDatabase(); IdentifyOrder(); RemoveStationFromOrder($query{'retract'}); UpdateOrderInDatabase(); PrintArrayToDatabase(); PrintForm(); } elsif ($query{'displaymap'}){ $form{'login'} = $query{'user'}; &PrintMap; } else { $error = "Script Error: Script called Incorrectly: $!"; &PrintError; } } elsif($ENV{'CONTENT_LENGTH'}){ &ParseForm; # user calls script from password page: form info # - need to check password if ($form{'verifyLogin'}){ &VerifyLogin; } # user calls script from form page to change display: form info # - need to return form page with requested items elsif ($form{'changeDisplay'}){ $method = "form"; &PrintForm; } else { $error = "Script Error: Script called Incorrectly: $!"; &PrintError; } } else{ # user calls script: no query string, no form info # - need to get login &Authenticate; }