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,

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.