I am working on a program that will read the password file and display a
list of users that match the gid's 670 & 671 on an html page. 

I have that part worked out, however now I want to have the results
display in groups of ten allowing the user to click on next results to
see the next results. I've tried to look at some examples but they are
for database search results which is causing me alittle confusion with
syntax. Does anyone have any sample code I can look at that reads from a
file displays the results as stated above.

Thanks,

Darryl 


#!/usr/local/bin/perl

open(PASSWD,"/etc/passwd") or die "Unable to open passwd:$!\n";

print "Content-type: text/html \n\n";

&display_html;
&open_list;
&display_tail;
close PASSWD;

sub open_list {
  while (<PASSWD>) {
    ($login, $passwd, $uid, $gid, $gcos, $home, $shell) = split(/:/);
    ($comment, $dash) = split(/-/, $gcos);
    if (($gid eq '670') or ($gid eq '671')) {
      print "<td align=center bgcolor=#74ccba>$login</td>\n";
      print "<td align=left bgcolor=#74ccba>&nbsp;$comment</td></tr>\n";
    }
  }
}

sub display_html {
  print "<HTML><HEAD><TITLE>User Listing</TITLE></HEAD>";
  print "<BODY BGCOLOR=#ffffff TEXT=#000000>";
  print "<CENTER>";
  print "<table border=0 cellpadding=2 cellspacing=2>\n";
  print "<tr><td bgcolor=#ddd7d7><center>User Name</center></td>\n";
  print "<td bgcolor=#ddd7d7><center>Comments</center></td></tr>\n";
};

sub display_tail {
  print "</table>\n";
  print "</CENTER>\n";
  print "</BODY>";
  print "</HTML>";
};



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to