HowTo redirect the login or logout url with ssi_login resp. ssi_logout

Started by andrea, October 12, 2004, 04:04:42 PM

Previous topic - Next topic


Seems ssi_login redirection isn't working after installing (not upgrading) of smf final, I have been trying all the ways but with failure BIG TIME!


me 2 ... isn't working...

because of SSI login isn't working... is it possible to make my own loginform ?
2 fields, username and password and send them to the loginURL ?
if so , how ?


i solved my problem another way.
There is a Problem with MODX and ssi_login(); with redirection.

so what i did is included thickbox.js and made a thickbox login thing...
you can see it here : [nofollow]

works great. there is just the Problem with the logout left.
after a while you can't logout... maybe i will solve that too.
thanx for the Help

i think people shuld try this way if the direct way isn't working.


if ($context['user']['is_guest']) {
echo '<div id="loggedOutDiv">';
$_SESSION['login_url'] = '' $_SERVER['PHP_SELF'];
echo '</div>';
else {
<div id="loggedIn">
Welcome, ' 
$context['user']['name'] . '
<br />
$_SESSION['logout_url'] = '' $_SERVER['PHP_SELF'];
echo '

log out works fine but log in does not work fine. So I am pretty sure I have everything set up correctly. I'm using version 1.1.1 of forums. (Upgraded from earlier version)


hey everybody!

here's my problem:

most of the time my login redirect works fine, but every once in awhile it shoots me to the main smf screen instead.  Then if I log off from the main smf page, then go back to my original page (the one with the ssi login), and log back in then the redirect works great.

Anyway, its tough for me to really troubleshoot because it doesn't happen every time.  Anyone got any ideas?

I'm using smf version 1.1.1.  my redirect looks like this:  <?php ssi_login($path); ?>, where $path is the path to that page.


i have had this problem for days and have been looking all over for a solution...and as far as i see, there is none, which is a bummer cuz i really liked smf but it looks like ill just hafta use a different forum, its too bad none of the smf admins have picked up on this and tried to help, theres gotta be a mod or something, well im still holding out so plz help us


does anyone know if this issue is being addressed in the next version?



c'mon, somebody's gotta have a solution for this problem, right?


I am having the same problem. What I just did was submit the URL I want to redirect to along with the username and password. If $_POST['redirect_to'] is set, I redirect to that. This way, it redirects every time I want it to, but it doesn't get stuck and redirect even when I don't want it to. For logout, I added the url via $_GET['redirect_to'].

The logout is a bit harder. Most of my pages are set up so if you go to a page and you aren't logged in, you just get the login box. For those, I could just use the $_SERVER['SERVER'] and $_SERVER['PHP_SELF'] to redirect back to the same page. For logout, though, I hardly ever want to redirect a guest back to the page that had the logout button. There's no way of getting what page to redirect to, though, so most of the logout links have to have the url manually added on to it, or a generic index page.

...I don't know if this is the best way to handle this, though.


I have tried most of the advice in earlier posts and still haven't resolved my problem which is...

I have a website;
&nbsp; [nofollow]
There is a download page; [nofollow]
I have SMF forum at; [nofollow]

Users arrive at my site at; [nofollow]
To use the site;
1/ using the menu they can go the the forum, but if they want to post they have to login, I wish them to log on at the forum.

2/ using the menu they can go to the downloads page.
If they have already logged in they can download files, if they haven't logged in they must see a message "you must login" and files are hidden.
When they login they must stay on this page., where they can download files.

When the user logs out it is preferable that they stay on the same page with message "logged out".

I know this has been covered loads of times but can anyone please please suggest some simple code to do the job that actually works?

With the downloads page there are 2 possible ways of accessing
1/ If not logged in, can't load the page.
2/ If not logged in, can't see certain areas on the page.
Whichever is easiest!


I have found a solution which almost works...

I have added a link in my forum to be able to switch back...
<a href=" [nofollow]">testfile</a>

the code for my testfile.php is...
   $_SESSION['login_url'] = ' [nofollow]' . $_SERVER['PHP_SELF'];   
   $_SESSION['logout_url'] = ' [nofollow]' . $_SERVER['PHP_SELF'];   
<head><title>test file</title></head>
<a href=" [nofollow]">forum</a>

There is a link to switch back to the forum.

If I log in on my testfile.php I stay on this page.
I am also logged in in forum.

If I logout on this page I stay on this page and I am logged out of forum. (ok so far)

If I login in forum I stay in forum and I am also logged in in testfile.php. (ok)

If I logout of forum I am logged out but redirect to testfile.php.

Almost there but not quite, can anyone please help further?


Hi all

I've been strugling with the same problem, with redirect on login and logout. As I am rather newish to forum software, I makes it even more difficult.

One thing I did notice, was after a logout, the address bar in the browser displays something like:

It seems as if the redirect url is added as parameters.

So why not create a new action?

That prompted me to do the following:

I added a new action named "redirect", and changed my redirect logout url to "action=redirect"

In the redirect template I called:


This seems to work for logout.

Now just for login....
Life is either a great adventure or nothing.
- Helen Keller


First of Hello! :-P

Second off...

Im trying for the first time to include SMF into a webiste using SSI. The redirects work fine, and the logout works fine, however, I'm running into a problem with logging in. When I log in, the page redirects to [nonactive] but then when it comes back to [nonactive] instead of showing a logout link like it should, it still shows the login boxs. I know that its loging me in though, because if I go to the forum, it shows me as logged in, then I can go back to the main page, and it shows me as logged in.

So long story short, when I log in useing SSI, its almost as if it does not know it logged me in. Is this a mistake on my part, and any ideas on how I can fix it?

The code I have now, trying to get the login box to go away, but even using this, it does not see me as logged in untill AFTER i go the to forums:
if ($user_info['is_guest'])
$_SESSION['login_url'] = '';
 ssi_login(); ?>
<br />

$_SESSION['logout_url'] = '';


I have also tried this:
['login_url'] = '';
 ssi_login(); ?>

<br />
     <?php $_SESSION['logout_url'] = '';


if ($context['user']['is_guest']) {
$_SESSION['login_url'] = '';
'<br />';

else {
$_SESSION['logout_url'] = '';


Also, have you tried:

Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"

Useful Links:
Online Manual!
How to Help us Help you
Settings Repair Tool


ok,   i have a site    ('')   and the smf forums    ('')     on the site i created, i have a header.php file, the middle files, and the footer.php  ....  ive tried everything in this whole post, and every time i login from my site, it takes me to the main page of the forum....everytime i log out of my site, i get the:

"An Error Has Occurred!
Session verification failed. Please try logging out and back in again, and then try again."

and it takes me to the forum... The login/logout goes into my header.php file... yet it doesnt work any way i have tried it...  any ideas.... 

I should also say that i have a different session id for each sub domain  ('forums.') and ('www.')
do i need to include a session_start(); anywhere or what...

sorry, but i just got this forum and like the features... but i am getting aggravated for all the trbl it has caused me by having a different sub domain for my forums page...  :(

Version Information:
Forum version: SMF 1.1.4
Current SMF version: SMF 1.1.4


the login and out works fine.
I inculded it via an iframe because of other header-manipulating scripts.
But if password or username is wrong it links to the forum password site.
You can see the problem at It's ok that the link goes to the passwort site, but it must be outsite of the iframe.

So my question: Where can I edit the link to the incorrect passwort page to include a target code?



nvm, it's wroking now  :-X


Topic locked.

Please read the whole topic and test the posted solutions before starting a new support request.

Note: It's best that each member starts their own topic about issues with redirecting -- this will save time and make sure that answers are personalized and as clear as possible, without becoming confusing because of too many people asking/answering in the same topic.

Thank you.

    Please do not PM me with support requests unless I invite you to.   ~

<H> I had zero posts when I started posting