PHP: Logout and redirect to set page of my choice?

Associate
Joined
29 Dec 2004
Posts
2,253
Heres the bit of PHP that logs a user out of Joomla and the integrated forums i use (PunBB), at the moment it logs the user out of everything but redirects them to the forum, but i would prefer it to redirect them to the Joomla homepage, i have tried changing the path from index.php to http://richl.com but it will just put the URL as:

http://DOMAIN/index.php?option=com_punbo&Itemid=34&task=http://richl.com

The path the logout script is: http://domain/components/com_punbo/board/
I want the person to go to: http://domain/

else if ($action == 'out')
{
if ($pun_user['is_guest'] || !isset($_GET['id']) || $_GET['id'] != $pun_user['id'])
{
redirect('index.php', "", true);
exit;
}

// logout from joomla
$mainframe->logout();

// logout from punBB
PUNlogout();

redirect('index.php', $lang_login['Logout redirect'], true);
}

How can i change the code to do this?

I also tried changing it to header:("Location: http://richl.com"); but that doesnt work either as i beleive it needs to be before the rest of the page and i cannot do that as all these scripts are nestled inside the main Joomla core...

Help!
 
Theyre useless, if im lucky someone will respond with a few weeks...you guys are on the ball, always right and always quick!

Plus - this is actually a PunBB bit of code, but it has been so heavily modified to integrate with joomla that when i post on the PunBB forum they tell me they dont know and to post on the Joomla forums...but obviously the Joomla people dont know anything about it as its just someones "add on" that they dont seem to develop anymore...i even tried emailing the developers of the PunBB mod (renamed PunLA) for some help with no luck!

The only thing i dont know what it does is "redirect"...is that a PHP standard function or is that something that would have been defined somewhere else within the PunBB config/include/function files?
 
Thats very nice of you, ill do that now...ill include everything i believe is necessary and kiss your feet if you have any luck... :)

Bare with me...
 
You are a very kind sir and a gentleman. I shall give this a try now, didnt realise i would need to change very much, but indeed goes to show why i asked the question :)

Even if this doesn't work id like you to know how much i appreciate there are still people like you around!
 
Works a treat - i take it most of that is pointless PunBB stuff and you have just modified it so it uses all of the PunBB functions (even if i have the redirect time specified to something other than 0) which is fantastic...not that im too keen on meta-refreshes so i dont think ill need that, but never mind!

Once again, appreciate all your help - now i can cool down and go to bed :)
 
Back
Top Bottom