login problem....plssss help

hello everyone…i am new for this script, hope u guys able to help me. Thank you in advance!
i have created register.php and it works, but i try login then the error message show:

Notice: Undefined index: password in C:\xampp\htdocs\login.php on line 26
The username and password you entered do not match those on file

im using xampp for localhost, all .php file i place it in xampp\htdocs for the users.txt( i create a users folder outside the htdocs, c:\xampp\users & i place my users.txt inside the users folder)

following is my login.php script:

Login <?php /// Script 11.7 - login.php /*This script logs a user in by check the stored values in text file. */

if(isset($_POST[‘submitted’])) { //handle the form

$loggedin = FALSE; //not currently logged in

//Enable auto_detect_line_settings:

//open the file:
$fp = fopen(’…/users/users.txt’,‘rb’);

//Loop through the file:
while($line = fgetcsv($fp,100,"\t")) {

  //Check the file data against the submitted data:
  if(($line[0] == $_POST['username'])AND($line[1] == md5(trim($_POST['password'])))) {
     $loggedin = TRUE; //correct username/password combination
     //stop looping through the file:
  } //End of IF

} //End of While

fclose($fp); //Close the file

//print a message:
if($loggedin) {
print ‘

You are now logged in.

} else {
print ‘

The username and password you entered do not match those on file


}else { //Display the form

//Leave php and display the form:



<?php }//end of submission IF. ?>

solved my problem !!! The password field is not called “password”

Sponsor our Newsletter | Privacy Policy | Terms of Service