#!/usr/local/bin/perl5 require "common.pl"; use Sprite; $webmaster = "shishir\@bu\.edu"; $query = undef; &parse_form_data(*FORM); $fields = '(Last|First|Job_Title|Department|EMail|Phone)'; foreach $key (keys %FORM) { if ( ($key !~ /\b$fields\b/o) || ($FORM{$key} =~ /[^\w\-\(\) ]/) ) { &return_error (500, "CGI Corporation Employee Database Error", "Invalid Information in Form."); } else { if ($FORM{$key}) { $FORM{$key} =~ s/(\W)/\\$1/g; $query = join (" and ", $query, "($key =~ /$FORM{$key}/i)"); } } } if ($query) { $query =~ s/^ and //; } else { &return_error (500, "CGI Corporation Employee Database Error", "No query was entered."); } $rdb = new Sprite (); $rdb->set_delimiter ('Read', ','); @data = $rdb->sql (< CGI Corporation Employee Directory
Полезная информация

CGI Corporation Employee Directory



End_of_HTML

    $~ = "HEADING";
    write;

    $~ = "EACH_ENTRY";
    
    foreach (@data) {
            s/([^\w\s\0])/sprintf ("&#%d;", ord ($1))/ge;

        ($last, $first, $job, $department, $email, $phone) =
            split (/\0/, $_, 6);
        write;
    }

    print "
", "\n"; print "
"; print "
", "\n"; } $rdb->close (); exit (0); format HEADING = Last First Job Title Department EMail Phone ---- ----- --------- ---------- ----- ----- . format EACH_ENTRY = @<<<<<<<< @<<<<<<<< @<<<<<<<<<<<< @<<<<<<<<<< @<<<<<<<<< @<<<<<<<<<<<<< $last, $first, $job, $department, $email, $phone .