redirect issue in my function |
Hi all,
I am trying to get the else part of this function to work. PHP Code: public function login_user_process(){ At the moment if I login correctly it works and lets me in, but if I get it wrong I just get a blank screen and it stays in the function instead of redirecting back to admin/login. Can anyone help please? Thanks, Doomie
Try to remove the echo "error" part... See https://codeigniter.com/user_guide/helpe...t#redirect
Quote:In order for this function to work it must be used before anything is outputted to the browser since it utilizes server headers.
Best regards,
José Postiga Senior Backend Developer
Looking at your function, if no rows are returned from your query, the function just ends.
You should preface your foreach with a check to see that there is actually some data to deal with. The 'else' part of that if would then deal with the fact that the login code does not exist, ie redirect back to login or error page or return an error message. Hence the blank screen when you use the wrong credentials. |
Welcome Guest, Not a member yet? Register Sign In |