Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 03 Oct 1999 12:52:17 +0200
From:      Gianmarco Giovannelli <gmarco@scotty.masternet.it>
To:        "Langa Kentane" <evablunted@earthling.net>, "FreeBSD" <Freebsd-questions@FreeBSD.ORG>
Subject:   Re: Help with smaill perl script
Message-ID:  <4.2.0.58.19991003122831.01342e40@194.184.65.4>
In-Reply-To: <007e01bf0d83$f609d6a0$0b02a8c0@sunnet.co.za>

next in thread | previous in thread | raw e-mail | index | archive | help
At 03/10/99, Langa Kentane wrote:
>Hi
>I don't know how to use perl and getting a book on it and reading would take
>too long to solve the small problem that I have.
>
>What I want to do is to have a web page showing all the user's home pages
>that will update dinamically.   What I mean it that when you access this
>page it should show you all the user names and link that to the user's home
>page.  When I add a new user it must show immediately as soon as I hit
>reload on the browser

Uhm... The easy way to do it is to read the passwd file and make as output 
HTML code pointing to the user home page, but after you have checked the 
user has really a public_html dir where he/she has stored his web pages...

If you want a sample code here is a very sample skeleton (25 sec of coding:-)

#!/usr/bin/perl

$public = "/public_html";

setpwent;

while(@list = getpwent){

   $login = $list[0];
   $uid = $list[2];
   if ($uid >= 999){
     $home = $list[7];
     if (-e "$home$public"){
       print "$login has an home page\n";
     }

   }
}


I can send you a new version with CGI.pm after lunch :-)




Best Regards,
Gianmarco Giovannelli ,  "Unix expert since yesterday"
http://www.giovannelli.it/~gmarco
http://www2.masternet.it





To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4.2.0.58.19991003122831.01342e40>