Hi, I’m new here, just started PHP need some help working on a login page. I have a password file with username:
There is two boxes one for login and password with a login button, how do i set the two boxes to search the file to see if the login and password is there. This is what i have.
[code]My Site with Authentication
Today is <?php echo date("m/d/Y"); ?>
Password:
<?php if (file_exists("password")) { echo "File is Found, "; } else { echo "File Not Found, "; } if (is_readable("password")) { echo "File is Readable"; } else { echo "File can not be read"; } ?>
File contents is:
<?php $aname=$_POST["login"]; $apass=$_POST["password"]; $crypt= crypt($apass,CRYPT_STD_DES); $crypted = $aname. ":" .$crypt;$fp = fopen(“password”, ‘r’) or die (“Could not open file, sorry”);
while (!feof($fp)) {
$line = fgets($fp, 1024);
echo $line."
";
}
fclose($fp);
?>[/code]
Thanks Much,
MOD EDIT: Removed password, added code tags