Hi
I have my script to generate a random username and password
and print it in the browser window
Now I need to define the username and password generated so that they are
written to the htaccess, htpasswd, and members.db file
here is the script
# Here we define the variables
$htpasswd = 'c:\apache\htdocs\members/.htpasswd';
$database = 'c:\apache\members.db';
# Here is the random gereration string
use strict;
print 'Please write this down as it will not be emaild ', "\n";
print 'for your own security ', "\n";
print 'Username: ', random_string(), "\n";
print 'Password: ', random_string(), "\n";
sub random_string {
my($string) = '';
my($length) = 8;
my(@chars) = ('A' .. 'Z', 'a' .. 'z', 0 .. 9);
while (length($string) != $length) {
$string .= $chars[ rand($#chars) ];
}
return($string);
}
# everything ok, let's write to database and send welcome email
open (DATABASE, ">>$database");
flock (DATABASE, 2);
print DATABASE "$username|$password\n";
flock (DATABASE, 8);
close (DATABASE);
$uselog = 1;
# Encrypts Password For Use With .htaccess Files.
if ($uselog eq '1') {
open (LOG, ">>$htpasswd");
print LOG "$username:$password\n";
close (LOG);
I'm just not sure how to make it so that after the random generation
they are also written to the specifyd file
Thanks
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]