first off let me say thank you for the help
I know I am a pest, but I am learning a lot

Anyway I fixed everything so it works fine in my editor
However now it refuses to work in my browser.
I keep getting an error 500
Which I can only assume is because of my html header.

I checked the subject in the Perl cookbook, The Perl Black book, and Perl
for dummies
all three are very limited and vague in this area, or I'm just looking in
the wrong place.

I would prefer to have the text pop up in small window with a separate
line for each statement
I am familiar with regular  html but have no clue as to how to use it
with cgi.

Thanks

# Here we define the variables

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.

use strict;

my $htpasswd = 'c:\apache\htdocs\members\.htpasswd';
my $database = 'c:\apache\members.db';

my ($username, $password) = (random_string(), random_string());

print "Password: $password\n";
print "Username: $username\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);
}

# get the date now!
my $date = &get_date;

# 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\n";
   close (LOG);
} 

sub get_date {
        my($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime(time);
        my@months =
("01","02","03","04","05","06","07","08","09","10","11","12");
        my@digits = split(//,$sec);
        my$size = @digits;
        if ($size == 1) {
                $sec = "0$sec";
        }
        @digits = split(//,$min);
        $size = @digits;
        if ($size == 1) {
                $min = "0$min";
        }
        $year=$year+1900;
        my $date = "$months[$mon]/$mday/$year";
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to