I have a small problem with my code, it's a Login\Password Protetion script:
The problem is that I use a HTML page for as the login page and even if the User Pass is correct it goes to wrong. All the syntaxes are correct. But I am pretty sure that :PHP Code:#!/usr/bin/perl
#Setup
$passfile = "userpass.txt";
#Get Data From form -> Buffer String
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
#put Buffer String into Query String
$query = $buffer;
#Split Username and Password
($username,$password) = split(/&/,$query);
#Split Field name and data for username > User string
($junk,$user) = split(/=/,$username);
#Split Field name and data for password > Pass String
($junk,$pass) = split(/=/,$password);
#Open password File
open INX, "$passfile";
#Read File into @Data Array
@data = <INX>;
#Close Pass File
close INX;
#For each Username@Password combination in file
foreach $dataz(@data) {
#Split the USername and Password > chkuser and chkPass strings
($chkUser,$chkPass) = split(/@/,$dataz);
#Compare Usernames and Passwords
if ($user eq $chkUser and $pass eq $chkPass) {
#If User@Pass matches, Authorization is GOOD
$auth = "GOOD";
}
}
#If Authorization is "GOOD" then
if ($auth eq "GOOD") {
#Open current GOOD HTML Page
open(INZ,"curpage.src");
#Read Page into @datax array
@datax = <INZ>;
#Close Current Page File
close(INZ);
#Show the page
print "Content-type:text/html\n\n";
print "@datax";
}
#If Authorization is Not GOOD
else {
#Tell the user they are bad
print "Content-type:text/html\n\n";
print "<center>*********Bad Boy!***********";
}
Is not reading it. Any help is appreciated!PHP Code:#Open password File
open INX, "$passfile";
Thanx,
Mikelo2k
![]()





Reply With Quote