Why, whats wrong with htdigest? Fianlly i did this and it worked!
use Digest::MD5;
...
...
#***********CHECK IF USER ALREADY EXISTS & ITS NOT AN AUTOMATED SCRIPT
+**********
$select = $dbh->prepare( "SELECT username, date FROM users WHERE usern
+ame = ? AND date > DATE_SUB(NOW(), INTERVAL 5 MINUTE)" );
$select->execute( $username );
if ( $select->rows ) {
print h1( {class=>'cyan'}, "Αυτός 	
+59; Χρήστης υπά`
+1;χει ήδη! Διάλ^
+9;ξε άλλο όνομα
+; χρήστη!" );
exit 0;
}
#***********ADD NEW USER TO THE DIGEST PASSWORD FILE & TO THE DATABASE
+**********
my $user = $username;
my $realm = "You Must Be Registered In Order To Post!";
my $pass = $password;
open(FILE, ">>/path/to/password/file") or die $!;
print FILE "$user:$realm:" . Digest::MD5::md5_hex("$user:$realm:$
+pass") . "\n";
close(FILE);
$select = $dbh->prepare( "INSERT INTO users (username, password, email
+, date, host) VALUES (?, ?, ?, ?, ?)" );
$select->execute( $username, $password, $email, $date, $host);
Isnt that approach an ok option to use?
ps. Is it safe to keep the password file inside the www directory or put it outside the webroot better?! |