are you trying to get the localtime in readable format? if so try this
print scalar(localtime);
Tor.
[EMAIL PROTECTED] wrote:
>
> Hi
>
> I'm trying to get my script to recognize the date and time.
> I thought I had it but I keep getting errors all over.
>
> Please take a look and tell me whats wrong
>
> Thanks
>
> # Here we define the variables
>
> use strict;
>
> my $htpasswd = 'c:\apache\htdocs\members\.htpasswd';
> my $database = 'c:\apache\members.db';
>
> print "Content-type: text/html\n\n";
>
> print 'Please write this down as it will not be emaild ', "\n";
> print 'for your own security ', "\n";
>
> # Here is the random gereration string.
>
> my ($username, $password) = (random_string(), random_string());
> print "Username: $username\n";
> print "Password: $password\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.
>
> open (DATABASE, ">>$database");
> flock (DATABASE, 2);
> print DATABASE "$username|$password|$date\n";
> flock (DATABASE, 8);
> close (DATABASE);
>
> # everything ok, now we write to the password file.
>
> my $uselog = 1;
>
> if ($uselog eq '1') {
> open (LOG, ">>$htpasswd");
> print LOG "$username:$password:$date\n";
> close (LOG);
> }
>
> sub get_date {
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime(time);
> @months =
> ("01","02","03","04","05","06","07","08","09","10","11","12");
> @digits = split(//,$sec);
> $size = @digits;
> if ($size == 1) {
> $sec = "0$sec";
> }
> @digits = split(//,$min);
> $size = @digits;
> if ($size == 1) {
> $min = "0$min";
> }
> $year=$year+1900;
> $date = "@months[$mon]/$mday/$year";
> }
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]