Topic: Redirect after invalid login

I have integrated PunBB with my site, that is I moved the login/logout
function to another page on my site, away from the native forum file.

Everything works well, except for one thing that I need to change.
I want to redirect the user to a custom page after a failed login attempt.

After reading countless posts about redirecting I still haven't found the answer.

Any suggestion will be greatly appreciated.

Trucktime

Re: Redirect after invalid login

Moved to Integration
Paste a copy of your login/logout file wink

Re: Redirect after invalid login

I use the files according to this thread:

http://punbb.org/forums/viewtopic.php?id=8786


Thanks,
Trucktime

Re: Redirect after invalid login

Oh, then you need to edit PunBB's login.php to redirect instead of using message

Re: Redirect after invalid login

Smartys wrote:

Oh, then you need to edit PunBB's login.php to redirect instead of using message

That's what I thought, but I can't figure out what I need to change in login.php

Thanks,

Trucktime

Re: Redirect after invalid login

    if (!$authorized)
        message($lang_login['Wrong user/pass'].' <a href="login.php?action=forget">'.$lang_login['Forgotten pass'].'</a>');

Re: Redirect after invalid login

Smartys wrote:
    if (!$authorized)
        message($lang_login['Wrong user/pass'].' <a href="login.php?action=forget">'.$lang_login['Forgotten pass'].'</a>');

I changed it to:
if (!$authorized)
        message($lang_login['Wrong user/pass'].' <a href="../index.php">'.$lang_login['Forgotten pass'].'</a>');

to redirect to the index.php file in the root.

However it keeps going to the  PunBB file login.php

Any idea why?

Thanks
Trucktime

Re: Redirect after invalid login

trucktime wrote:

Any idea why?

The `message()` occurs in login.php. All you did was change a link inside the message. You need to use a redirect instead (like Smartys said before).

if (!$authorized)
    redirect('index.php', $lang_login['Wrong user/pass'])

Re: Redirect after invalid login

Yep, that did the trick.

Thank you both for the help, I appreciate it.

Trucktime