Topic: how to use login redirect from mainpage

I'm using punbb:s login system to my site and after logging in there are a redirect to the page that you were on before you cliked login, but this only happens if this page is in the forum directory (example.com/forum), I want it to accept all pages over this directory (example.com)

Found out that it's thiis line that determine if referer is vaild:

$redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#^'.preg_quote($pun_config['o_base_url']).'/(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : 'index.php';

But my skills in preg_match isn't so good, help please?

Re: how to use login redirect from mainpage

I think $pun_config['o_base_url'] is why...

Re: how to use login redirect from mainpage

Try this:

$redirect_url = (isset($_SERVER['HTTP_REFERER']) && preg_match('#(.*?)\.php#i', $_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : 'index.php';
"Programming is like sex: one mistake and you have to support it for the rest of your life."