Uutiset:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu
Advertisement:

login redirects

Aloittaja MisterCat, syyskuu 28, 2013, 07:32:19 AP

« edellinen - seuraava »

MisterCat

Hi folks,

I'm having trouble getting my head round what exactly happens when someone logs in.

I'm trying to set up a redirect so that if I log in from my domain's index page, it takes me back there. But if I log in from the forum index, it takes me back there and not to my main domain index. I've tried all sorts and it just seems to keep directing me to either one or the other no matter where I log in.

Does anyone have that handy code snippet?

Cheers

margarett

What exactly is your index page? Is it a portal, or a custom built site, integrated to SMF via SSI, .......?

AFAIK, the default behaviour is:
- When you logout, you are always redirected to forum index
- When you login, you stay in the board/topic you were as guest

This is dealt by function "login2" in LogInOut.php

void Login2()
........
- after successful login, redirects you to $_SESSION['login_url'].
........
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

MisterCat

It's the latter, just a custom site with bits linked into the forum via ssi.

I'm just trying to personalise it for the user and link it in as a kind of general overview of what's going on on the forum.

I've tried $_SESSION['login_url'] = 'http://www.mydomain.com' . $_SERVER['PHP_SELF']; at the top of hxxp:mydomain.com/index.php [nonactive] which has the desired effect of coming back to this page when a user logs in from it with the ssi login function.

However, if they first go to the forum from this page and log in on the forum's main index page they get directed back to the home page of the site above, but I'd like them to stay on the forum.

It seems no matter what I've tried I can't seem to have both.

Advertisement: