#!/usr/bin/perl
#######################################################################################
#
# Question Manager V2.0
# ©2000, Perl Services
#
# Requirements: UNIX Server, Perl5+
# Created: September 22nd, 2000
# Author: Jim Melanson
# Modifications: John Krinelos
# February, 2001
# June, 2001
#
# Contact: www.perlservices.net
# Phone: 1-760-249-3676
# Toll-Free: 1-877-751-5900 CONUS only
# Fax: 1-760-249-9917
# E-Mail: info@perlservices.net
#
# File Name: Question.cgi
#
#######################################################################################
#######################################################################################
#
# DO NOT EDIT
# ANYTHING
# IN THIS FILE
#
#######################################################################################
#System Constants
$PROGRAMDIR = "Question";
$PROGRAMNAME = "Web Site Question Manager";
$PROGRAMVERSION = "V2.0";
$RELEASEDATE = "June 2001";
#Concantenate the configuration file name.
$cfg_file = $PROGRAMDIR . "_cfg.cgi";
#Get the config file
require $cfg_file;
#Add the Data key
$PROGRAMDIR .= $DataKey;
#Set the data path.
if(-d "$ENV{'DOCUMENT_ROOT'}/ris_datalogs/$PROGRAMDIR") {
$Data = "$ENV{'DOCUMENT_ROOT'}/ris_datalogs/$PROGRAMDIR";
} else {
$Data = "$DefaultData/ris_datalogs/$PROGRAMDIR";
}
&Initialize;
&Parse;
&Date;
&GetCookies;
#Determine if we are using a secure server. If so, use that specified URl
#otherwise concantenate the Script URL dynamically.
if($SecureServer) {
$SecureServer =~ s/$PROGRAMDIR\.cgi/$PROGRAMDIR\_admin\.cgi/g;
$ScriptURL = $SecureServer;
} else {
$ScriptURL = "http://$ENV{'SERVER_NAME'}$ENV{'SCRIPT_NAME'}";
}
if($ENV{'QUERY_STRING'} =~ /^submit/) {
&Process;
} else {
&PrintForm;
}
sub Process {
if($FORM{'email'} && $FORM{'name'} && $FORM{'message'}) {
my $PID = $PID_DATE;
my $time = time;
if(open(QUESTION, ">$Data/questionfiles/$PID.ftf")) {
flock(QUESTION, '2');
print QUESTION "name||$FORM{name}\nemail||$FORM{email}\n";
print QUESTION "date||$SHOW_TIME on $SHOW_DATE||$time\n\n\n"; # 3 new lines
print QUESTION "$FORM{message}\n";
close QUESTION;
backup("$Data/questionfiles/$PID.ftf");
&upquestioncount;
$WARN = qq~Thank-you $FORM{name}! Your submission has been received and we will respond
as soon as we review it. Below is a copy of your submission.
~;
if($CONFIG{'notifyadminonquestionsubmit'} == 1) {
if(open(MAIL, "|$CONFIG{'mailprogram'} -t")) {
print MAIL "To: $CONFIG{'adminemail'}\n";
print MAIL "From: $CONFIG{'adminemail'}\n";
print MAIL "Subject: Question Manager has received a new question!\n";
print MAIL "A new question requiring a response has been recieved.\n\n";
$adminurl = $ScriptURL;
$adminurl =~ s/Question.cgi$//;
$adminurl .= "Question_admin.cgi";
print MAIL "Login at:\n$adminurl\n\n\n";
print MAIL "Notice Courtesy of $PROGRAMNAME $PROGRAMVERSION\n\n";
print MAIL "Submitted by : $FORM{email}\n\n";
print MAIL "Question is : \n";
print MAIL "$FORM{message}\n\n";
close MAIL;
}
}
if($CONFIG{'redirect_em'}) {
print "Location: $CONFIG{'redirect_em'}\n\n";
} else {
&PrintForm;
}
} else {
$WARN = qq~
WARNING: An error occured and we were unable to record your questions.
Your input is important to us so please e-mail
your question to our Administrator.
~;
&PrintForm;
}
} else {
$WARN = qq~
WARNING: You forgot one to fill in a field. All fields are mandatory.
~;
&PrintForm;
}
}
sub PrintForm {
&PrintHead;
if((($ENV{'HTTP_USER_AGENT'} =~/MSIE/i) && ($ENV{'HTTP_USER_AGENT'} !~/OPERA/i) && ($ENV{'HTTP_USER_AGENT'} !~/AOL/i)) || ($ENV{'HTTP_USER_AGENT'} =~/NETSCAPE/i)){
$but_events = qq~ class="buttoff" onmouseover="this.className='button'" onmouseout="this.className='buttoff'"~;
} else {
$but_events = qq~~;
}
unless($CONFIG{useheader} == 1) {
print qq~