Hello soil, you gives a clue that pushs.
now i am succeeding with random pass, which writes in pass file and sent
random pass per email. But with random userid is not clear even though with studing
yours. I get per email $userid as same as password (alpha) ???
Below is changes in both db,html and db.cgi
sub html_add_success {
$password = &generate_password;
srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
my @salt_chars = ('A' .. 'Z', 0 .. 9, 'a' .. 'z', '.', '/');
my $salt = join '', @salt_chars[rand 64, rand 64];
my $encrypted = crypt($password, $salt);
open (PASSWD, ">>$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) {
flock(PASSWD, 2) or &cgierr("unable to get exclusive lock on $auth_pw_file.\nReason: $!");
}
print PASSWD "$userid:$encrypted:$view:$add:$del:$mod:$admin:$email\n";
close PASSWD;
$userid = &generate_randomID;
print userid "$userid:$encrypted:$view:$add:$del:$mod:$admin:$email\n";
close userid;
my (%rec) = &get_record($in{$db_key});
open (MAIL, "$mailprog") || &cgierr("Can't start mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";..........................
------------------------------------------------
db.cgi
sub generate_password {
# --------------------------------------------------------
#### Following subroutine added for secure_password_lookup mod
my (@c, @v, $password);
srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
@c = split(/ */, "bcdfghjklmnprstvwxyz");
@v = split(/ */, "aeiou");
for ($i=1; $i<=4; ++$i) {
$password .= $c[int(rand(20))] . $v[int(rand(5))];
}
return $password;
}
sub generate_randomID {
my (@c, @v, $randomID); srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
@c = split(/ */, "bcdfghjklmnprstvwxyz");
@v = split(/ */, "aeiou");
for ($i=1; $i<=4; ++$i) {
$randomID .= $c[int(rand(20))] . $v[int(rand(5))];
}
return $randomID;
}
thanks
------------------------------------------
now works with random userid which is sent to guest as a number but does not write in pass file?
after the change in db.cgi as belows;
sub generate_randomID {
my (@c, @v, $randomID); srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
@c = split(/ */, "1234567890");
@v = split(/ */, "5344");
for ($i=1; $i<=8; ++$i) {
$randomID .= $c[int(rand(20))] . $v[int(rand(5))];
}
return $randomID;
}
now i am succeeding with random pass, which writes in pass file and sent
random pass per email. But with random userid is not clear even though with studing
yours. I get per email $userid as same as password (alpha) ???
Below is changes in both db,html and db.cgi
sub html_add_success {
$password = &generate_password;
srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
my @salt_chars = ('A' .. 'Z', 0 .. 9, 'a' .. 'z', '.', '/');
my $salt = join '', @salt_chars[rand 64, rand 64];
my $encrypted = crypt($password, $salt);
open (PASSWD, ">>$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) {
flock(PASSWD, 2) or &cgierr("unable to get exclusive lock on $auth_pw_file.\nReason: $!");
}
print PASSWD "$userid:$encrypted:$view:$add:$del:$mod:$admin:$email\n";
close PASSWD;
$userid = &generate_randomID;
print userid "$userid:$encrypted:$view:$add:$del:$mod:$admin:$email\n";
close userid;
my (%rec) = &get_record($in{$db_key});
open (MAIL, "$mailprog") || &cgierr("Can't start mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";..........................
------------------------------------------------
db.cgi
sub generate_password {
# --------------------------------------------------------
#### Following subroutine added for secure_password_lookup mod
my (@c, @v, $password);
srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
@c = split(/ */, "bcdfghjklmnprstvwxyz");
@v = split(/ */, "aeiou");
for ($i=1; $i<=4; ++$i) {
$password .= $c[int(rand(20))] . $v[int(rand(5))];
}
return $password;
}
sub generate_randomID {
my (@c, @v, $randomID); srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
@c = split(/ */, "bcdfghjklmnprstvwxyz");
@v = split(/ */, "aeiou");
for ($i=1; $i<=4; ++$i) {
$randomID .= $c[int(rand(20))] . $v[int(rand(5))];
}
return $randomID;
}
thanks
------------------------------------------
now works with random userid which is sent to guest as a number but does not write in pass file?
after the change in db.cgi as belows;
sub generate_randomID {
my (@c, @v, $randomID); srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
@c = split(/ */, "1234567890");
@v = split(/ */, "5344");
for ($i=1; $i<=8; ++$i) {
$randomID .= $c[int(rand(20))] . $v[int(rand(5))];
}
return $randomID;
}