Jay77710 Posted December 29, 2007 Share Posted December 29, 2007 My login system without mysql isn't validating my login info right. I'll register, then go to the login page. My problem is, when I login (I'm using the "test" username and "test" password I registered with. And I don't think I'm typing it in wrong) it says that my username and password do not match. here is the login.php that the login script uses <?php if (isset ($_POST['submit'])) { $loggedin = FALSE; $fp = fopen ( 'users.txt', 'rb' ); while ( $line = fgetcsv ($fp, 100, "\t")) { if ( ($line[0] == $_POST['username']) AND ($line[1] == crypt ($_POST['password'], $line[1]) ) ) { $loggedin = TRUE; break; } } } if ($loggedin) { print ("You are now logged in!"); } else { print ("The username and password did not match!"); } ?> and this is the user.txt that it pulls the info from test $1$iIujXdC1$hnHez0KjeD7jch0Xz8yH/1 11988036902649 if you can help me figure this out, that would be great. Link to comment https://forums.phpfreaks.com/topic/83539-need-help-with-my-login-system/ Share on other sites More sharing options...
MadTechie Posted December 29, 2007 Share Posted December 29, 2007 this doesn't look right to me ($line[1] == crypt ($_POST['password'], $line[1]) ) shouldn't it be ($line[1] == crypt ($_POST['password']) ) or ($line[1] == crypt ($_POST['password'], $line[0]) ) Link to comment https://forums.phpfreaks.com/topic/83539-need-help-with-my-login-system/#findComment-425045 Share on other sites More sharing options...
Jay77710 Posted December 29, 2007 Author Share Posted December 29, 2007 I'll try that Link to comment https://forums.phpfreaks.com/topic/83539-need-help-with-my-login-system/#findComment-425057 Share on other sites More sharing options...
Jay77710 Posted December 29, 2007 Author Share Posted December 29, 2007 I'm still getting the same thing Link to comment https://forums.phpfreaks.com/topic/83539-need-help-with-my-login-system/#findComment-425478 Share on other sites More sharing options...
redarrow Posted December 29, 2007 Share Posted December 29, 2007 try this <?php if (isset ($_POST['submit'])) { $username=$_POST['username']; $password=$_POST['password']; $loggedin = FALSE; $fp = fopen ( 'users.txt', 'rb' ); while ( $line = fgetcsv ($fp, 100, "\t")) { if ( ($line[0] == crypt ($password), $line[1]) ) ) { $loggedin = TRUE; break; } } } if ($loggedin) { print ("You are now logged in!"); } else { print ("The username and password did not match!"); } ?> Link to comment https://forums.phpfreaks.com/topic/83539-need-help-with-my-login-system/#findComment-425487 Share on other sites More sharing options...
Jay77710 Posted December 29, 2007 Author Share Posted December 29, 2007 still not working :-\ Link to comment https://forums.phpfreaks.com/topic/83539-need-help-with-my-login-system/#findComment-425500 Share on other sites More sharing options...
redarrow Posted December 29, 2007 Share Posted December 29, 2007 try <?php if (isset ($_POST['submit'])) { $username=$_POST['username']; $password=$_POST['password']; $loggedin = FALSE; $fp = fopen ( 'users.txt', 'rb' ); while ( $line = fgetcsv ($fp, 100, "\t")) { if ( ($line[1] == crypt ($password) ) { $loggedin = TRUE; break; } } } if ($loggedin) { print ("You are now logged in!"); } else { print ("The username and password did not match!"); } ?> Link to comment https://forums.phpfreaks.com/topic/83539-need-help-with-my-login-system/#findComment-425503 Share on other sites More sharing options...
Jay77710 Posted December 29, 2007 Author Share Posted December 29, 2007 when I register, it creates an empty folder using that users id... should I put something in that folder? Link to comment https://forums.phpfreaks.com/topic/83539-need-help-with-my-login-system/#findComment-425508 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.