JeanieTallis Posted April 4, 2009 Share Posted April 4, 2009 I have a login form, and it doesn't log me in, it just pretty much refreshes, it knows when theres an invalid username, when the user is correct, it don't login. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/152562-login-form-not-logging-in/ Share on other sites More sharing options...
AdRock Posted April 4, 2009 Share Posted April 4, 2009 You need to post your code so we can see twhat the problem is Quote Link to comment https://forums.phpfreaks.com/topic/152562-login-form-not-logging-in/#findComment-801268 Share on other sites More sharing options...
JeanieTallis Posted April 4, 2009 Author Share Posted April 4, 2009 I don't know what part is causing the problem. Login goes to session, and checks if username and password is correct, if no errors it then it updates fields eg: (last login) etc, and then it sets the cookie, then returns true; which I think then goes to process, then it takes you back to the URL referer which is index.php, as it knows your logged in, due to cookies, it shows what it should show to logged in users. What should I post? Quote Link to comment https://forums.phpfreaks.com/topic/152562-login-form-not-logging-in/#findComment-801274 Share on other sites More sharing options...
revraz Posted April 4, 2009 Share Posted April 4, 2009 Then do some troubleshooting and see which script is failing. echo your variables, put in echo's at IF statements..etc. Quote Link to comment https://forums.phpfreaks.com/topic/152562-login-form-not-logging-in/#findComment-801278 Share on other sites More sharing options...
JeanieTallis Posted April 4, 2009 Author Share Posted April 4, 2009 function procLogin(){ global $session, $form; /* Login attempt */ $retval = $session->login($_POST['user'], $_POST['pass'], isset($_POST['remember'])); /* Login successful */ if($retval){ header("Location: ".$session->referrer); } /* Login failed */ else{ $_SESSION['value_array'] = $_POST; $_SESSION['error_array'] = $form->getErrorArray(); header("Location: ".$session->referrer); } } Instead of 'header("location: ".$session->referrer); after, if($retval), I put echo("no error here"); it displays echo, so, index.php (login) goes to process.php, which then is right. then process.php includes session.php, which just checks for errors, and then registers session values (cookies for 'remember me' option) I've tried all if's in all them. No idea what else to try, session.php includes form (just sets error fields) database, which has confirms user and pass, which also sets errors if the username or password isn't correct, and I know they work. (I tested using incorrect details) I can't think of where else to try. seeing as, if the username and password are correct, it would return 0; Would anyone mind adding my MSN and look at it for me? Quote Link to comment https://forums.phpfreaks.com/topic/152562-login-form-not-logging-in/#findComment-801307 Share on other sites More sharing options...
JeanieTallis Posted April 4, 2009 Author Share Posted April 4, 2009 All error fields work the way they should do. I may add, index.php goes to session.php which then uses process.php and process.php works, but its just not recognising its logged in. which is why it refreshes the page, so it checks the database, but just doesn't log in. Quote Link to comment https://forums.phpfreaks.com/topic/152562-login-form-not-logging-in/#findComment-801308 Share on other sites More sharing options...
revraz Posted April 4, 2009 Share Posted April 4, 2009 Make sure you have session_start(); at the start of each page that uses sessions. Make sure you have error reporting and display enabled to check for any header errors. Quote Link to comment https://forums.phpfreaks.com/topic/152562-login-form-not-logging-in/#findComment-801361 Share on other sites More sharing options...
JeanieTallis Posted April 4, 2009 Author Share Posted April 4, 2009 It all worked, until I added in 'location' on the login form, so no idea whats causing it to not login. Whats the code for error reporting. Session starts are enabled. Quote Link to comment https://forums.phpfreaks.com/topic/152562-login-form-not-logging-in/#findComment-801367 Share on other sites More sharing options...
JeanieTallis Posted April 4, 2009 Author Share Posted April 4, 2009 Anybody any idea's, what I could do, you can assist me on MSN, if you find it easier to look at the whole files. (might be quicker that way) Quote Link to comment https://forums.phpfreaks.com/topic/152562-login-form-not-logging-in/#findComment-801414 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.