Hello all, I'm very pleased with my new perl script, which is designed for the web.
However I have never migrated a perl script to CGI, and I was wondering if anyone knew how I would do it.
The script is fairly small and simple:
-----------------------------------------------
#!/usr/bin/perl -w
print "\n\n username 2 create... "; $username = <STDIN>; print "\n";
chomp($username);
open (USERS, "< C:/users.dat" || die;
@users = <USERS>;
close(USERS);
$size = $#users;
if ($username gt $users[$#users]) {
open (USERS, ">> C:/users.dat" || die;
print USERS $username, "#", $#users + 1, "\n";
close(USERS);
}
else {
$x = 0;
until ($username le $users[$x]) {
$x++;
}
@half = (splice(@users, $x));
$username .= "#"; $username .= $size + 1; $username .= "\n";
push (@users, $username);
push (@users, @half);
open (USERS, "> C:/users.dat" || die;
print USERS @users;
close(USERS);
}
print "\n\n password 2 create... "; $password = <STDIN>; print "\n";
$val = int(rand(59));
chomp($password);
$len = (length($password));
$z = 0;
open (PASS, ">> C:/passwords.dat" || die "can't open PASS file!\n";
until ($z == $len) {
$letter = substr($password, $z, 1);
$letter2 = $val * (ord($letter));
$z++;
print PASS $letter2, "#";
}
print PASS $val, "\n";
close(PASS);
-------------------------------------------------
Thankyou to anyone and everyone who responds. After I learn how the script changes for CGI I will be able to learn more and do it myself.
Thankyou very much!!!!!!
JoE we are all of us living in the gutter.
But some of us are looking at the stars.
However I have never migrated a perl script to CGI, and I was wondering if anyone knew how I would do it.
The script is fairly small and simple:
-----------------------------------------------
#!/usr/bin/perl -w
print "\n\n username 2 create... "; $username = <STDIN>; print "\n";
chomp($username);
open (USERS, "< C:/users.dat" || die;
@users = <USERS>;
close(USERS);
$size = $#users;
if ($username gt $users[$#users]) {
open (USERS, ">> C:/users.dat" || die;
print USERS $username, "#", $#users + 1, "\n";
close(USERS);
}
else {
$x = 0;
until ($username le $users[$x]) {
$x++;
}
@half = (splice(@users, $x));
$username .= "#"; $username .= $size + 1; $username .= "\n";
push (@users, $username);
push (@users, @half);
open (USERS, "> C:/users.dat" || die;
print USERS @users;
close(USERS);
}
print "\n\n password 2 create... "; $password = <STDIN>; print "\n";
$val = int(rand(59));
chomp($password);
$len = (length($password));
$z = 0;
open (PASS, ">> C:/passwords.dat" || die "can't open PASS file!\n";
until ($z == $len) {
$letter = substr($password, $z, 1);
$letter2 = $val * (ord($letter));
$z++;
print PASS $letter2, "#";
}
print PASS $val, "\n";
close(PASS);
-------------------------------------------------
Thankyou to anyone and everyone who responds. After I learn how the script changes for CGI I will be able to learn more and do it myself.
Thankyou very much!!!!!!
JoE we are all of us living in the gutter.
But some of us are looking at the stars.