[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] CGI Script Question



on 8/13/00 9:40 AM, Cmopollux@xxxxxxx at Cmopollux@xxxxxxx wrote:

> In a message dated Sun, 13 Aug 2000 10:26:20 AM Eastern Daylight Time, "H.P.
> Stroebel" <hpstr@xxxxxxxxxxxxx> writes:
> 
> << Cmopollux@xxxxxxx schrieb:
> 
>> I am making s sign up page for customers and I was wordering if any of you
>> know how to make a script (.pl or .cgi) that can check to see if a username
>> is taken by any of the virtual sites?
> 
>> you can parse /etc/passwd, it contains all usernames >in the first field.
>> be careful, don`t let the cgi put out too much info.
> 
> Any ideas how to do this?  I am really new to .pl

Its a pretty simple proceedure.  If you are starting to get into PERL
scripting I would *highly* suggest purchasing all the PERL books from
O'Reilly: PERL Cookbook, PERL in a Nutshell, Learning PERL, Programming PERL
etc.  They are all top notch and a great buy.

essentially it would be something like this

#!/usr/bin/perl

open FH, "/etc/passwd" or die "Can't Open passwd file";
while (<FH>) {
    @columns = split(/,/,$_);
    $username = @columns[0];
    print $username . "\n"; // do whatever you want with it
}


-k