#!/local/bin/perl require "cgi-lib.pl"; use Msql; package main; @NAMES=("account", "passwd", "uid", "gid", "name", "home", "shell", "sname"); print << "EOF"; Content-type: text/html

Academic Accounts

EOF &ReadParse(*input); $q1=""; foreach $i (@NAMES){ if($input{$i}ne ""){ print "\n"; $q1.="$i,"; } } print "\n"; chop $q1; $dbh = Msql->Connect("","accounts") or die "not ok 1: $Msql::db_errstr\n"; $condition=$input{'QUERY'}; $query="select $q1 from accounts where $condition"; print "The query string is $query

\n"; $sth = $dbh->Query("$query"); while( @row = $sth->FetchRow){ $j=0; print "

"; foreach $i (@NAMES){ if($input{$i} ne ""){ print ""; $j++; } } print "\n"; } print "
$i
@row[$j]
\n"; print "\n";