Re: A question about setup, with CERN httpd

Lance W. Bledsoe (
Wed, 10 May 1995 20:51:13 +0500

In a previous message Lisajoy posted:


I think your script sounds interesting, but I'd need some instructions.
I'm not too clear about Perl, actually and honestly, I'm clueless. Pleas
be in touch.


Here is some html code which will run the script: (add this to your
home page or wherever...)

<dt> <a href="/cgi-bin/userpages.cgi"> Users with Home Pages </a>
<dd> Automatically generated index of User Home Pages</dd>

Theses two files need to be in your cgi-bin directory: (the permissions
*must* match these.)

1 -rwxr-xr-x 1 www www 141 Apr 24 14:08 userpages.cgi*
1 -rwxr-xr-x 1 www www 736 Apr 24 14:16*

% pwd

Here is the "userpages.cgi" shell script which will envoke the perl script
with the input from your systems passwd file: (save this code to a file
called "userpages.cgi" in the cgi-bin directory.)

# Script to use to show the users with pages.

echo Content-type: text/html
echo < /etc/passwd


This is the "" code: (save this code to a file
called "userpages.cpl" in the cgi-bin directory.)

# ^^^^^^^^^^^^^ replace this with the path of perl executable

# The next several lines contain stuff which would normally be
# part of an html doc. (Whatever you like...)
# (NOTE: notice the placement of the "\" before embedded quotes,
# and the "\n" at the end of each line!)

print "<body BACKGROUND=\"/avalon/texture.gif\">\n";
print "<hr>\n";
print "<img alt=\"Avalon Enterprises Inc\" src=\"/avalon/aeilogo.gif\">\n";
print "<br>\n";
print "<hr>\n";
print "<br>\n";

# This is the "meat" of the code...

print "<HEAD>\n<title>Users with Home Pages</title>\n";
print "<h3>Users with Home Pages...</h3><p>\n";
print "<ul>\n";

while(<STDIN>) {
($login, $pw, $uid, $gid, $gcos, $home, $shell) = split(/:/);
($name, $office, $workph, $homeph) = split(/,/, $gcos);
if (-e "$home/public_html/index.html") {
print qq!<li><a href="/~$login/">!;
#print "$login ($name)</a>\n"; }
print "$name</a>\n"; }

# Place html code here (in print "...", of course) which you would want
# at the end of the page...

print "</ul>\n";

# End of file.

NOTE: you may want to change this script so that it's run once a day,
with the output going to a "userpages.html" file, if you have a large
number of users.

Hope this helps...


---=== -- ===---
Avalon Enterprises, Inc. can develop or host your Web Page, Mailing List,
FTP Site or other Internet Service, on our quick server, at a minimal cost.
Please send email, or browse for details.