Jump to content

Search for Contents of File with HTML Boxes


eagleeye678

Recommended Posts

Hi, I'm new here, just started PHP need some help working on a login page. I have a password file with username:09mklksdf0

 

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.

 

<title>My Site with Authentication</title>

Today is <?php echo date("m/d/Y"); ?>

 

<form method= "post" action="/testsite/index.php">

Login:

<input type = "text" name="login">

<p>Password:

<input type = "password" name="password"></p>

<p>

<input type = "submit" value="Login">

<br>

<br>

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

}

?>

<br>

<p> File contents is:</p>

<?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."<br/>";

}

        fclose($fp);

 

?>

 

 

Thanks Much,

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.