Search String from HTML Text box

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"); ?>



<?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."


Thanks Much,

MOD EDIT: Removed password, added code tags

isset() is what you’re looking for. Why don’t you use a database for managing your username(s) and password(s)?

Sponsor our Newsletter | Privacy Policy | Terms of Service