/[docman]/adduser.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /adduser.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Fri Jan 26 12:39:34 2001 UTC (18 years, 5 months ago) by dpavlin
Branch: MAIN
CVS Tags: v1_3, r1_5
File MIME type: text/plain
perl script for adding users

1 #!/usr/bin/perl -w
2
3 # perl script to add users to Document Manager's .htusers file
4
5 use Digest::MD5 qw(md5_hex);
6
7 my $htpasswd = shift @ARGV || ".htusers";
8
9 my $login = shift @ARGV;
10 if (! $login) {
11 print "login: ";
12 $login=<STDIN>; chomp $login;
13 }
14
15 my $fullname = shift @ARGV;
16 if (! $fullname) {
17 print "full name: ";
18 $fullname=<STDIN>; chomp $fullname;
19 }
20
21 my $passswd = shift @ARGV;
22 if (! $passswd) {
23 print "password [auth_pop3]: ";
24 $passwd=<STDIN>; chomp $passwd;
25 if ($passwd eq "") {
26 $passwd="auth_pop3";
27 } elsif (substr($passwd,0,5) ne "auth_") {
28 $passwd=md5_hex($login.$passwd);
29 }
30 }
31
32 my $email = shift @ARGV;
33 while (! $email || $email !~ /@/) {
34 print "e-mail: ";
35 $email=<STDIN>; chomp $email;
36 print "e-mail address needs to have @ for auth_pop3 to work!\n" if ($email !~ /@/);
37 }
38
39 if (! -e "$htpasswd") {
40 print "creating $htpasswd\n";
41 open(HTPASSWD,"> $htpasswd") || die "open $htpasswd: $!";
42 } else {
43 open(HTPASSWD,">> $htpasswd") || die "append $htpasswd: $!";
44 }
45 print HTPASSWD "$login:$fullname:$passwd:$email\n";
46 close(HTPASSWD);

  ViewVC Help
Powered by ViewVC 1.1.26