PDA

View Full Version : Hybrid site: redirect after page


StewardManscat
07-03-2004, 11:21 AM
Pasting together an existing site with vb3 and cmps...

Some areas are for registered members only. The registration system is now vb3. I cannot convert all of the old site into vb3/cmps at once. I think I need a "hybrid" to get by.

So in my old sections I write:


if ($NoCurrentSession) {
header("Location: /forum/cmps_index.php?page=forbidden");
exit;
}


where "forbidden" is a cmps page with no access privleges. So this brings up the "You are not logged in" prompt, which is desired.

But of course, after login, the system returns to "You do not have permission to access this page". It's the God's honest truth. But if the user clicks again on where they were going, they are off to the races.

All site areas are linked across the top, and all are always enabled. This is desired. The ones which go to vb pages behave correctly: after denial followed by login, the system redirects to the original page.

I wonder how I can mimic this to support old sections... ?

Thanks in advance.

Brian
07-03-2004, 08:13 PM
I'm not entirely sure I understand what you're trying to do, so please excuse me if this is not correct... Once you log into vBulletin though, it will redirect you to the page that you logged in from. Since they logged in from your forbidden page, they are going to be redirected to that page. I might suggest adding a custom php module for that page which will check to see if a user is logged in, and if not, then print the error. Then change the code you posted above to something like this:
if ($NoCurrentSession) {
header("Location: /forum/cmps_index.php?page=forbidden&return=http://yoursite.com/whatever_page_here");
exit;
}

You could then use the 'return' part in the URL there to redirect the user to that specific page in the module that you created, assuming that they are logged in. ;)

Our Sponsors
 

StewardManscat
07-06-2004, 01:43 PM
You understood perfectly and your answer is helpful, thank you.

I had hoped there might be some magic buried in either vb or vbadvanced already...