From owner-freebsd-questions Sun Oct 3 3:48:16 1999 Delivered-To: freebsd-questions@freebsd.org Received: from scotty.masternet.it (scotty.masternet.it [194.184.65.2]) by hub.freebsd.org (Postfix) with ESMTP id 4322214BFF for ; Sun, 3 Oct 1999 03:48:08 -0700 (PDT) (envelope-from gmarco@scotty.masternet.it) Received: from suzy (modem34.masternet.it [194.184.65.44]) by scotty.masternet.it (8.9.3/8.9.3) with ESMTP id MAA81076; Sun, 3 Oct 1999 12:47:52 +0200 (CEST) (envelope-from gmarco@scotty.masternet.it) Message-Id: <4.2.0.58.19991003122831.01342e40@194.184.65.4> X-Sender: gmarco@scotty.masternet.it X-Mailer: QUALCOMM Windows Eudora Pro Version 4.2.0.58 Date: Sun, 03 Oct 1999 12:52:17 +0200 To: "Langa Kentane" , "FreeBSD" From: Gianmarco Giovannelli Subject: Re: Help with smaill perl script In-Reply-To: <007e01bf0d83$f609d6a0$0b02a8c0@sunnet.co.za> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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