#!/usr/bin/perl use CGI qw(:standard); use Pg; $dbmain='ldp'; @row; $count = 0; $query = new CGI; # Connect to database $conn=Pg::connectdb("dbname=$dbmain"); $username = $query->remote_user(); $result=$conn->exec("SELECT username, admin, maintainer_id FROM username WHERE username='$username'"); @row = $result->fetchrow; $admin = $row[1]; $result=$conn->exec("SELECT editor_id, editor_name, email FROM editor ORDER BY editor_name"); die $conn->errorMessage unless PGRES_TUPLES_OK eq $result->resultStatus; # print the page print header(-expires=>'now'); print "LDP Editors"; print ""; print ""; print ""; print "

LDP Editors

\n"; system("./navbar.pl"); print "

\n"; print "\n"; while (@row = $result->fetchrow) { $editor_id = $row[0]; $editor_name = $row[1]; $editor_email = $row[2]; if ( $editor_name eq "" ) { $editor_name = 'J. Doe' } print "\n"; print "\n"; print ""; $count++; } print "
NameEmail
\n"; print a({href=>"editor_edit.pl?editor_id=$editor_id"},"$editor_name"); print "\n"; print a({href=>"mailto\:$editor_email"},"$editor_email"); print "
\n"; print "

Count: $count"; if ($admin eq 't') { print "


\n"; print "

New Editor

\n"; print "

\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "
Name:
Email:
\n"; } print end_html;