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

Re: [cobalt-users] CGI Script Question



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

a bit off-topic, isn`t it ?

open a filehandle, split the fields and read the first field of the file
in an array; then compare the variable containing the desired name to
the array. you can compare to the whole line too, but that could create
problems if someone desires a name that is contained elsewhere in the
file ("bash" e.g.).

you can use the internal perl function that was mentioned in this
thread, but i never used it. maybe even more efficient.

if you are new to .pl ( i assume you mean perl), consider reading a good
book first. i recommend "learning perl", o`reilly.




-- 

H. P.  Stroebel, Germany

CGI-FAQ for Raq-Newbies :
http://users.iol.it/hpstr/

A problem to some is a 'feature' to others.