Link to home
Start Free TrialLog in
Avatar of jon88654
jon88654Flag for United States of America

asked on

Need help with PHP flat file login system.

I am trying to create a flat file login system, when I log in to the system via the username and password I set in my .txt flat file, I recieve an error message that reads:

"Warning: file(/LoginTest/userlist.txt) [function.file]: failed to open stream: No such file or directory in /home2/shb8_008/bt3software.com/public_html/LoginTest/validate.php on line 12
Could not open file /LoginTest/userlist.txt"

The code for the validate file around line 12 is:

"require_once('config.php');

function checkLogin($user,$pass)
{
      global $file;      
      $users=file($file) or die("Could not open file <b>$file</b>");
      foreach($users as $userInfo)
      {
            if ( trim(substr($userInfo,33))==$user && substr($userInfo,0,32)==$pass )
                  return 1;
      }
      return 0;
}"

I am new to PHP and would appreciate any help you guys gave provide.  Thanks a lot.  

-Jon

ASKER CERTIFIED SOLUTION
Avatar of Roger Baklund
Roger Baklund
Flag of Norway image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial