Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This may be a dumb question but I'm new to cgi programming and aint proud. Just need to learn how to do it. I've tried locating the report generator inside the cgi-bin and running it in it's own directory. The behavior is that the system call is ignored both ways! Thanks#!/usr/bin/perl -wT #use strict; use CGI qw(:standard); # important shortcuts use Fcntl qw(:flock); # imports LOCK_EX, LOCK_SH, LOCK_NB my $timestamp = localtime; my $userID = 'No'; my $passwrd; sub bail { my $error = "@_"; print h1("Unexpected Error"), p($error), end_html; } sub runReports { print "Generating Reports\n"; system("./Kreports.plx"); } $TITLE = "Kim's Report Generator"; $LOGFILE = "/usr/tmp/KreportLog"; print header,start_html($TITLE),h1($TITLE); $q = CGI->new(); #my ( $name, $value); print hr, start_form; # hr() emits a horizontal rule: <HR> #print $q->p( $timestamp ); print p( "User ID:", $q->textfield( -NAME => "name" ) ); print p( "Passwrd:", $q->password_field( -NAME => "passwrd")); print p( submit( "send" ), reset( "clear" ) ); print hr; print end_form; # for each name in hash produce the value foreach $ID ( $q->param ) { foreach $value ( $q->param( $ID ) ) { if ( $value eq 'Kim' ) { $userID = 'OK'; } if ($value eq 'Knecht' ) { $passwrd = 'OK'; } } } my $ret; if ( ($userID eq 'OK') and ($passwrd eq 'OK') ) { &runReports(); } else { print "Unauthorized!\n"; }
|
|---|