Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: andrea on October 12, 2004, 04:04:42 PM

Title: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: andrea on October 12, 2004, 04:04:42 PM
Login

The SSI function ssi_login();   shows the forum login box. The url to be loaded after the login is performed can be controlled by setting the variable $_SESSION['login_url'].

Here is a sample script:

Quote
<?php
include('/pathtoyour/SSI.php');

print "Here are some PHP commands. <br />";

$_SESSION['login_url'] = 'http://urltoyourindexpage';
ssi_login();

print "Here are some more PHP commands. <br />";

?>



Logout

The function ssi_logout();   shows the logout link. After the logout the user is redirected to the boardindex. By setting the variable $_SESSION['logout_url'] you can control the link where the user is sent to after the logout.

Here is a sample script:

Quote
<?php
include('/pathtoyour/SSI.php');

print "Here are some PHP commands. <br />";

$_SESSION['logout_url'] = 'http://urltoyourindexpage';
ssi_logout();

print "Here are some more PHP commands. <br />";

?>
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: [Unknown] on October 12, 2004, 05:25:11 PM
In RC2, at least, these are equivalent:

$_SESSION['login_url'] = 'http://www.example.com/';
ssi_login();

And:
ssi_login('http://www.example.com/');

It's just a short cut.  The same goes for logout.  But, note - this won't work with older, modified SSI.php's.

-[Unknown]
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: HoTmetal on October 29, 2004, 08:16:17 PM
Ok that works great... Now where do I change it so that they hit my index page of my site when logging in/out while using the login/out buttons that I have called in using ssi_menubar(); ?? OR I gues sI could just remove the login/out button from within the themes temp. hmm...any better Ideas,,,, thanks again RickC
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: [Unknown] on October 29, 2004, 09:57:55 PM
$_SESSION['login_url'] = 'http://www.example.com/';
ssi_menubar();

-[Unknown]
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Kender on November 05, 2004, 08:41:35 PM
for those who want a login on every page (templated) and want to return to that page after

<?php
$current_url $_SERVER['PHP_SELF']; 
ssi_login($current_url); 
?>


<?php
$current_url $_SERVER['PHP_SELF']; 
ssi_logout($current_url); 
?>


this will return you to where they logged in at, or out at
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: HoTmetal on December 09, 2004, 04:46:50 PM
Thanks Kender thats just what I was looking for. Now is there a way to add it so that the user goes to the /forum/index.php?action=login, then once they log in, it shoots them back to where they were before?

The reason I want to know is I stopped using the ssi for the login, now I have the nav bar ssi'ed onto every page. 
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: [Unknown] on December 09, 2004, 08:02:29 PM
Currently, I'm afraid there is not :/.

-[Unknown]
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: nosleep on December 12, 2004, 01:01:23 PM
Into which file exactly must I place this code:

$_SESSION['logout_url'] = 'http://urltoyourindexpage';
ssi_logout();


sorry, but I am new to this.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: [Unknown] on December 13, 2004, 12:13:48 AM
Into the file you wish to show a link to logout from.  What are you trying to show?

-[Unknown]
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: nosleep on December 13, 2004, 12:20:50 AM
I don't want to show anything. I simply want to make it so that when people Logout with the normal logout button (as on any template), they are redirected to another site.

That is the code I need. As I'm new to this I would be grateful if I could be told which code to insert to exactly where to achieve my task.

Thank you.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: [Unknown] on December 13, 2004, 03:28:49 AM
So you mean, log out from the forum - not from your SSI driven site?

If so, in LogInOut.php, find:
// Empty the cookie! (set it in the past, and for ID_MEMBER = 0)
setLoginCookie(-3600, 0);


After those lines, add:
$_SESSION['logout_url'] = 'http://www.google.com/';

-[Unknown]
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: nosleep on December 13, 2004, 04:15:23 AM
thanks millions, this is what I needed - works fine :)
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Foden on January 08, 2005, 08:09:37 PM
Is there a way you can configure in LogInOut.php the url for both logging and out to return to the referring URL?

$ref = getenv('HTTP_REFERER');

That is what you would use to get the reffering url - would that help in any way?
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: andrea on January 09, 2005, 12:12:06 AM
Is described in reply #4 of this thread.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Foden on January 09, 2005, 01:41:33 AM
Yes I saw that thread, but I was meaning for a global way, like in case you were actually browsing a forum as well.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: jgoodsell on March 09, 2005, 02:28:05 PM
if I include login ssi on a page, how then to check if user is logged in?

also, is it possible to show login form only if user is not logged in, and show logout otherwise?

i basically want to have login for a site and if logged in, extra content is available. but i am unsure how to check if user is logged in, i don't see some SSI to do this.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: [Unknown] on March 11, 2005, 07:22:06 PM
<?php

require_once('/path/to/SSI.php');

is_not_guest('Members only content!');

?>


The stuff only members can see.


Or:

<?php

require_once('/path/to/SSI.php');

if (
$user_info['is_guest'])
{
?>


Stuff for guests!

<?php
}
else
{
?>


The stuff only members can see.

<?php
}
?>


-[Unknown]
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: NukeWorker.com on March 15, 2005, 11:01:43 AM
On my home page, I have this code:

         <?php
         $current_url = $_SERVER['PHP_SELF'];
         ssi_login($current_url);
         ?>

         <?php
         $current_url = $_SERVER['PHP_SELF'];
         ssi_logout($current_url);
         ?>

When I login and imediatly logout, it works fine. 

If I login then exit the browser, then open a new browser and try to logout with that command, I get this error:

Session verification failed. Please try logging out and back in again, and then try again.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: [Unknown] on March 16, 2005, 12:00:20 AM
You have to get a session and session id before you can log out.  You can't just copy the logout link and go directly there, because that session id is going to be invalid.

-[Unknown]
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: NukeWorker.com on March 16, 2005, 12:47:24 PM
Shouldn't includding the ssi.php handle that?  If not, how do I get a session and session id?
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: ajnus on March 19, 2005, 10:41:09 PM

<?php 
                
require_once ('forum/SSI.php');
$current_url $_SERVER['PHP_SELF']; 
ssi_login($current_url); 
?>



Is there anything wrong with writing the above code? I placed it in http://mysite.com/index.php but when i click login it always ends up at http://mysite.com/forum/index.php

Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: andrea on March 20, 2005, 06:11:01 AM
Use the commands precisely as they are in the 1st post of this thread.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: ajnus on March 20, 2005, 09:23:30 AM

<?php 
include ('forum/SSI.php');
print 
"test<br />";
$_SESSION['login_url'] = 'http://www.mywebsite.com/index_test.php';
ssi_login();
print 
"test<br />";


I inserted the above code in http://www.mywebsite.com/index_test.php but when i login from there it still does not redirect me back to index_test.php but instead goes to http://www.mywebsite.com/forum/index.php. I think the code is exactly the same as the 1st post of this thread? or am i doing something wrongly  :(
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: NukeWorker.com on March 20, 2005, 10:43:56 AM
The only thing I can see is that you have the begining of the php "<?php" but not the closing of php "?>"
Also, you don't need those print statements.  What version of the software are you using,  and try the OTHER example, where you put the session info into the ssi_login function call.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: juncmodule on April 16, 2005, 02:14:30 PM
Sorry to dig up an old thread. While searching for a way to include a login I found this thread which led me to the point I am at now. Basically the login part works fine, logout gives me the error I've listed in the code below. I am unable to redirect the page to anywhere but my forum index. I have tried several different ways and searched the forums for further info without success. I would just like to redirect the login page back to itself (I intend on including the php file on my main page). Both passing the url to $_SESSION and ssi_login(); don't seem to work. Any help would be greatly appreciated.


<?php 
include('../public_html/smf/SSI.php');
//require('../public_html/smf/SSI.php'); // doesn't seem to matter if I use require or include...does it?

$_SESSION['login_url'] = '../public_html/login.php'// seems to have no effect
//ssi_login('../public_html/login.php'); 
ssi_login(); 
// logs me in, redirects to smf index however, not login.php

$_SESSION['login_url'] = '../public_html/login.php'// seems to have no effect

//ssi_logout('../public_html/login.php');
ssi_logout();
// always causes error: ( Session verification failed. Please try logging out and back in again, and then try again. )
?>



thank you,
-junc
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: [Unknown] on April 16, 2005, 04:46:28 PM
The login_url is a URL, not a path.  It should not include public_html, unless you see this in your address bar:

http://www.example.com/public_html/

-[Unknown]
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: juncmodule on April 16, 2005, 06:29:38 PM
Unfortunately, that's not it, thank you for trying though...

I was only trying a path out of desperation. I've run out of ideas.

Any other possibilities? Is it possible that there is a forum feature that I have enabled or disabled that would prevent this? It just seems that people randomly fix it and the solutions never really state that the code is wrong. I'm assuming there must be some other mistake I've made...

Any help is appreciated...

thanks,
-junc
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: rmnoonan on April 18, 2005, 12:05:30 PM
I have tried everything on this page, and I just can't seem to login/logout and NOT go into the forum itself.  I want to simply have all login and logout activity stay at my site's index page, giving the user the ability to enter the forum only once they are logged in via a link on the index page.  I have turned off the database driven sessions also.  Can someone help please?  Every time I log in, it takes me into the forum!

SMF 1.0.3
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: HoTmetal on April 20, 2005, 01:53:46 PM
Yeah, I'm having the same problem too. Though I think mine may be server related (I"m not sure)
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: juncmodule on April 22, 2005, 12:10:51 AM
Hmmm...Interesting that so many people are having problems. [Unknown] does this work in a beta version? Perhaps it is a problem that was addressed. Every response I've seen in this thread and elsewhere indicates that this *should* work. Perhaps a default setting when SMF is installed on some servers that prevents this from happening. I'm becoming convinced that it's not code but perhaps a permission on a file somewhere...some sort of security thing?

later,
-junc
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: andrea on April 22, 2005, 01:52:49 AM
The above code works perfectly fine on my own forum for example. Guys, when you ask for support then please post the precise code which you use and also the precise links (to your login page and to your forum as well).
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: juncmodule on April 22, 2005, 07:51:45 AM
Sorry about the no link thing:

http://www.juncmodule.com/login.php

I went back to the original code from the first post:


<?php
include('../public_html/smf/SSI.php');

print 
"Here are some PHP commands. <br />";

$_SESSION['login_url'] = 'http://www.juncmodule.com';
ssi_login();

print 
"Here are some more PHP commands. <br />";

?>



later,
-junc
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: costanza on May 12, 2005, 10:28:46 AM
Quote from: rmnoonan on April 18, 2005, 12:05:30 PM
I have tried everything on this page, and I just can't seem to login/logout and NOT go into the forum itself.  I want to simply have all login and logout activity stay at my site's index page, giving the user the ability to enter the forum only once they are logged in via a link on the index page.  I have turned off the database driven sessions also.  Can someone help please?  Every time I log in, it takes me into the forum!

SMF 1.0.3

Same thing with me; i have tried all the code examples in this thread but the SSI login always always always takes me to the forum, no matter what.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: andrea on May 12, 2005, 01:29:24 PM
Hm. I will test the code of the 1st post in my 1.0.3 test forum and double check if it works like this with 1.0.3.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: HoTmetal on May 12, 2005, 06:29:18 PM
Quote from: andrea on May 12, 2005, 01:29:24 PM
Hm. I will test the code of the 1st post in my 1.0.3 test forum and double check if it works like this with 1.0.3.


Thanks. I'll be looking forward to it :D
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: costanza on May 13, 2005, 09:09:01 AM
Quote from: andrea on May 12, 2005, 01:29:24 PM
Hm. I will test the code of the 1st post in my 1.0.3 test forum and double check if it works like this with 1.0.3.

Thanks, i've been running around with myself on this so much that i'm wondering if it ever will work.  I've tried all the code examples in this thread, as well as "hard coding" it in a few places, but to no avail.  I wonder if its a server setting, or a php session setting, or something like that, i just have no clue.  thanks.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: WAC on May 16, 2005, 08:03:25 PM
as in many of the above situations i have tried all the different examples in this post with no avail. I was able to do it when i copied the SSI into my index file, and then changed the $scripturl to my sites url. This, in the end, did redirect to the site, however it never really left the site, aka... it didnt login to the forum. as far as i can see, the ways suggested here arent workin... thx for the help thus far.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: weekend camper on May 31, 2005, 05:08:35 PM
A not so shameless bump, as I have just spent some time also researching this.


Anyone?



@edit:  at least part of the problem (for me) was that I had some HTML at the top of the SSI calling page.  So ... make sure that there is nothing (no lines/HTMLs) before


<?php
require("/home/xxx/public_html/xx/SSI.php"); 
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: HoTmetal on May 31, 2005, 11:38:37 PM
Quote from: [Unknown] on December 13, 2004, 03:28:49 AM
So you mean, log out from the forum - not from your SSI driven site?

If so, in LogInOut.php, find:
// Empty the cookie! (set it in the past, and for ID_MEMBER = 0)
setLoginCookie(-3600, 0);


After those lines, add:
$_SESSION['logout_url'] = 'http://www.google.com/';

-[Unknown]

Is this why all my users get an error on line 98 of the LogInOut.php??

Thanks in advance RIckC
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: [Unknown] on June 01, 2005, 02:24:51 AM
I'm not sure.  What're lines 95-100?

-[Unknown]
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: HoTmetal on June 01, 2005, 10:23:44 PM
Quote from: [Unknown] on June 01, 2005, 02:24:51 AM
I'm not sure.  What're lines 95-100?

-[Unknown]

Same old stock  LogInOut.php.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: [Unknown] on June 01, 2005, 10:26:53 PM
Then you shouldn't get any errors...?  I'm not sure why you would have any on those lines from my copy.

-[Unknown]
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: natem345 on June 04, 2005, 11:23:24 PM
Quote from: [Unknown] on December 09, 2004, 08:02:29 PM
Currently, I'm afraid there is not :/.

-[Unknown]

Here's how I did it; seems to work for me. In LogInOut.php under:
   // Set the login URL - will be used when the login process is done.
   
I took out the if/else and just put:
$_SESSION['login_url']= getenv('HTTP_REFERER');

Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: costanza on July 06, 2005, 09:34:20 AM
Ok, I hate that this was the solution... but of course the new version solved my problem.  I used the code from the first post in this thread and it works like a charm.  I'm referring to 1.1 beta 3 of course.  Thanks everyone for all the help though.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: HoTmetal on September 05, 2005, 02:06:06 PM
Ok I've been sooooooooooooo busy. I haven't had time to post this latly. This is  from my LogInOut.php. I included the line numbers. I keep getting errors  on 98.
Quote
97         // Strike!  You're outta there!
98      if ($_GET['member'] != $ID_MEMBER)
99         fatal_lang_error('login_cookie_error', false);


Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Rudolf on September 05, 2005, 02:21:37 PM
The ssi_login and ssi_logout functions have a redirect_to parameter.

You can simply use ssi_login('www.yourdomain.com/your/site/page.php');
Similarly ssi_logout('www.yourdomain.com/your/site/page.php');

It's that simple. What's with that $_SESSION thing??!!  :-\

Rudolf

EDIT: now I see that this is an old thread, maybe already dead  :-[
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: HoTmetal on September 05, 2005, 03:56:45 PM
Quote from: rudiksz on September 05, 2005, 02:21:37 PM
The ssi_login and ssi_logout functions have a redirect_to parameter.

You can simply use ssi_login('www.yourdomain.com/your/site/page.php');
Similarly ssi_logout('www.yourdomain.com/your/site/page.php');

It's that simple. What's with that $_SESSION thing??!!  :-\

Rudolf

EDIT: now I see that this is an old thread, maybe already dead  :-[

Yeah, it was an old thread, but I brought it back to life.... My SSI login works, but I wanted my users to login & stay on the same page that they logged in on.....I set it up , but the way I did it, didn't work with the new ver. of SMF. & now I get an error on line 98
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Rudolf on September 05, 2005, 11:44:28 PM
What errors are you getting? The code you shown doesn't says too much.
You have to declare the $ID_MEMBER to use it. I'm not even sure if that's available in the SSI.  :-\
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: HoTmetal on September 26, 2005, 09:22:49 PM
Quote from: rudiksz on September 05, 2005, 11:44:28 PM
What errors are you getting? The code you shown doesn't says too much.
You have to declare the $ID_MEMBER to use it. I'm not even sure if that's available in the SSI.  :-\
I used the code givin here. [
quote author=rickc link=topic=18077.msg273916#msg273916 date=1117597117]
Quote from: [Unknown] on December 13, 2004, 03:28:49 AM
So you mean, log out from the forum - not from your SSI driven site?

If so, in LogInOut.php, find:
// Empty the cookie! (set it in the past, and for ID_MEMBER = 0)
setLoginCookie(-3600, 0);


After those lines, add:
$_SESSION['logout_url'] = 'http://www.google.com/';

-[Unknown]

Is this why all my users get an error on line 98 of the LogInOut.php??

Thanks in advance RIckC
[/quote]

But I've since upgraded to a newer ver of SMF. <SMF 1.0.5.> But I plan on upgrading to SMF 1.1 RC1 this weekend. Should this mod work with  SMF 1.1 RC1.? OR has the LogInOut.php chanced again? Thanks in adance rickC
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: zodiak on November 15, 2005, 05:05:29 AM
I also have the login-redirect problem. Here is the code used for calling the function:

include($path_forum_absolute.'SSI.php'); // the include works fine
ssi_login($path_livesite); //  $path_livesite = 'http://www.mydomain.com/'


But every time I finish at the forum home page.
As far as I managed to debug the problem I found out that at some point the $_SESSION['login_url'] is deleted. Probably before the redirect is called.

Any body found a solution?

P.S. I.m using SMF 1.0.5
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: zodiak on November 16, 2005, 05:09:58 AM
Ok I tried SMF 1.1 RC1.

With Database driven sessions login redirect doesn't work.
When I turned them off it worked.

Why?

P.S. Same thing on 1.0.5. I finaly tried it.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: maddezi on December 08, 2005, 09:55:43 PM
Ok I have gone through eveything that was post here because i was looking for the easy way out. And the only thing that work  was the log_out
// Empty the cookie! (set it in the past, and for ID_MEMBER = 0)
setLoginCookie(-3600, 0);
$_SESSION['logout_url'] = 'http://www.yoursite.com///';


But as i kept on trying no one could have really get the log_in to work. what I have done is erase under the // Set the login URL - will be used when the login process is done.:--
if (isset($_SESSION['old_url']) && (strstr($_SESSION['old_url'], 'board=') !== false || strstr($_SESSION['old_url'], 'topic=') !== false))
$_SESSION['login_url'] = $_SESSION['old_url'];
else
unset($_SESSION['login_url']);

And placed
$_SESSION['login_url'] = 'http://www.yoursite.com///'; it works like a dime.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: oxynom on December 12, 2005, 09:26:40 PM
OK after about 6 hours guessing and trying I finally figured it out this works.

The login and logout function are stored in the file 'loginout.php'. Why for some the logout function works is because, when you click on logout then you don't get through any step (page) before you get logged out. That means you click it and you are gone. One step and the $_SESSION['logout_url'] works.

So if you put:

$_SESSION['logout_url'] = 'http://www.yoursite.com/';

or

$_SESSION['logout_url'] = $_SERCER['PHP_SELF'];

both will work


THE LOGIN

The login won't work this way because it goes to a login screen. The best you can get with this is you land at the LOGIN SCREEN but with yourself already logged in! :-[

One way to solve this problem is to find the redirectexit() function. ( was to lazy to do that, and it's my first day using SMF) so i figured out a handy way.

I put this into the header of my Webpages [note: not the forum header (index.template.php)]

$current_url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];

and in the box where i have my login i put this:


<?php
include "ssi.php";

if (
$context['user']['is_logged'])
{
echo $txt['hello_member'], ' <b>'$context['user']['name'], '</b>';
echo '.<br /><a href="index.php?action=profile">Profile</a> | ';
ssi_logout($current_url);
}
else
{
ssi_login($current_url);
}
?>



The reason why I used "http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']" to locate my current url is because anyother type i used would end up unreconizeable for the SMF. The url would look something like this if I would have used $_SERVER['PHP_SELF']:

URL: http://myserver.com/forum/index.php?home.php

I called ssi_login from from my homepage(home.php).

Well this works for me now...and i hope i could help you guys out.

Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: goofy2feet on January 08, 2006, 12:27:44 AM
The following code on my SSI-driven page does not work - on log-in I am always sent to the forum index, not the url in $current_url. On log-out I am re-directed to the forum index, generating 'An Error has occurred' page.


include '../lglbbs/SSI.php';
$current_url='http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
$page="links"; // variable I use elsewhere in the page
...
...
if (!$context['user']['is_logged']) { // check if user is logged in or not
echo 'BBS Members - please log-in using your usual
username and password for full functionality.';
ssi_login($current_url);
} else if ($context['user']['is_logged']) {
ssi_logout($current_url);
}


Even with this code set, when I hover over the logout link - the status bar shows the target url as:
http://language-global.com/lglbbs/index.php?action=......
There is no 'www.' in the url - is this what is causing the error page on logout? In any case why is $current_url ignored by both ssi functions??

EDIT: Then I tried the same thing again but with database-driven sessions disabled : the result was that both ssi_login and ssi_logout function as expected.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: HoTmetal on January 08, 2006, 01:07:38 AM
Hmmm ... It seems to me I did something similar. If I recall, I added my own header into the  index template.php & used a similar code there. But since then, I've added Joomla CMS to my site & it has a feature like this built in. Good to see someone posted a work around here though, as I have forgoten about this thread :D
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: psychophat on January 16, 2006, 04:11:54 PM
goofy2feet try doing Reply #10 by [Unknown] it works. You can incorporate it to your logout without any errors but it redirects you to the forum index. Haven't heard from anyone if there is a workaround for this to end up back to anypage or the referring page from which you logged out from, still waiting.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Gregory on January 19, 2006, 11:07:07 AM
YEAH!!! Got it working  :D

I had <? php and never noticed that space before the < before.

Also, people should note that if your page/site structure is built up using includes the inclusion of ssi needs to go before any of your files output html or spaces. (I gather this is because the SSI needs to login and then redirect back before the page outputs stuff)
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: goofy2feet on January 20, 2006, 12:09:07 AM
Quote from: [Unknown] on December 13, 2004, 03:28:49 AM
So you mean, log out from the forum - not from your SSI driven site?

If so, in LogInOut.php, find:
// Empty the cookie! (set it in the past, and for ID_MEMBER = 0)
setLoginCookie(-3600, 0);


After those lines, add:
$_SESSION['logout_url'] = 'http://www.google.com/';

-[Unknown]
This only seems to be about logging out; my main problem is with logging in.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Captain_Morrigan on March 13, 2006, 06:58:49 PM
Ok, I've tried practically all of the suggestions here.

I really want my board to redirect to the current page when not on SMF. I have tried all suggestions but I don't want to put a static page to redirect to. So if I am on my News page I want it to redirect to my news page if I'm on my downloads page I would expect it to redirect to my downloads page. All suggestions here still redirect me to my forum.

Now could it be that my forum is on a subdomain instead of a subfolder?

I must admit the one:
$_SESSION['logout_url'] = 'http://www.google.com/';
Does work if I'm not using variables.

When I echo the results from the variables it shows the correct data but it is not showing the correct page on redirect.

I think what it is is when it logs the redirect it is losing the information in the LogInOut.php file because I am no longer on the main page I am in the subdomain.

Generally what I want is:
I'm here:
http://site.com/downloads.php
I login.
I'm here:
http://site.com/downloads.php

Or any other page that I'm on. Right now what I'm getting is:
I'm here:
http://site.com/downloads.php
I login.
I'm here:
http://subdomain.site.com/index.php

Also, the logout doesn't work either so I need to fix both.

If you can PM me the results but I will be checking back here regularily.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: JayBachatero on March 13, 2006, 07:03:47 PM
You can use
$_SESSION['login_url'] = 'http://site.com' . $_SERVER['PHP_SELF'];

If you have query string like index.php?news use
$_SESSION['login_url'] = 'http://site.com' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Captain_Morrigan on March 13, 2006, 07:24:13 PM
That did not work. When I put that in there it still redirects me to the main page. I think this is because it no longer has the strings in the URL because once you submit the form it is then at the LogInOut.php instead of at the main page still.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: JayBachatero on March 13, 2006, 07:32:03 PM
Yea it should work.  I use that on my site.  Do you have Use subdomain independent cookies enabled?  Also did you add it after the call to SSI.php?
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Captain_Morrigan on March 13, 2006, 07:33:21 PM
Yes, the being logged in works fine the redirection is not.

Could you post the five lines above and below that code from yours to make sure I'm putting it in the correct place?
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: JayBachatero on March 13, 2006, 07:56:51 PM
I added right after include('/path/to/forum/SSI.php');
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Captain_Morrigan on March 13, 2006, 08:37:56 PM
That's where my problem was. Thank you very much!  ;D
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: JayBachatero on March 13, 2006, 09:56:19 PM
You're welcome.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: saztar on March 21, 2006, 11:07:08 AM
i read over this topic, and it hit close to my problem, but when the problem was brought to light in 1.1 RC2 was causing the problem, i dont think it was ever fully solved, becuase it was still a problem for me ;)

so simply put i will go over what i did to correct the problems i was having.

i tried setting the session login_url before calling the ssi_login()

didn't work..

i tried sending the $currenturl with the call to ssi_login()

didn't work..

so i decided to get my hands dirty and edit some code to do what i wanted it to do.. so here is what i did.. now please remember.. if you dont know what it means, dont change it, if you want to change it, back it up!... if you dont back it up, change it, and mess everything up.. don't blame me ;)

now before making my call to ssi_login() i set $_SESSION['saz_login_url'] to the url i want the script to send the user back to..

then i opened Source/LogInOut.php

and around line ... 416.. 416..

i found..

redirectexit('action=login2;sa=check;member=' . $ID_MEMBER, $context['server']['needs_login_fix']);

and replaced it with..

        if($_SESSION['saz_login_url'])
            redirectexit($_SESSION['saz_login_url']);
    else
redirectexit('action=login2;sa=check;member=' . $ID_MEMBER, $context['server']['needs_login_fix']);


simple as that.. everything works without a problem now.

Tony~!
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Flonne on April 13, 2006, 02:26:55 AM
require("smf/SSI.php");

// Script writen by Tomer "Lamper" Dean.
// **NOTE** Always check that the require statement is correct!
// A script that checks if your a guest, and if guest, puts a login box,
// and if user, put a welcome message.

// Checks which membergroup you are in.
ssi_welcome();
if ($context['user']['is_guest'])
   {
ssi_login('www.pinkattackbunnies.com/default.php');
   }
else
   {
ssi_logout('www.pinkattackbunnies.com/default.php');
   }
?>


^That's my script, it works when logging out but not when logging in.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: JayBachatero on April 13, 2006, 01:37:55 PM
Did you read through the pages?  Use $_SESSION['login_url'] and so on.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: yellow1912 on April 14, 2006, 12:43:58 AM
Quote from: JayBachatero on March 13, 2006, 07:03:47 PM
You can use
$_SESSION['login_url'] = 'http://site.com' . $_SERVER['PHP_SELF'];

If you have query string like index.php?news use
$_SESSION['login_url'] = 'http://site.com' . $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
Still not working for me :(
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: yellow1912 on April 14, 2006, 12:56:35 AM
Ok, I just got it fixed, somehow require("smf/SSI.php");  must be the first line, above any other things.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: ms_ukyankee on April 14, 2006, 10:29:11 PM
Just setting up a new site with a fresh install of 1.1 RC2. I have other sites using SSI and the api and don't have this problem, I've spent an hour searching here trying to find a solution but coming up empty.

I'm using the standard redirection with ssi_login, and it works fine. The problem is that once I've visited the website page with SSI, if I haven't logged in there and then go to the forum to login, the forum login redirects me to me to the SSI page, and also if I logout from the forum. ???
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: yellow1912 on April 14, 2006, 10:32:03 PM
Well, it's easy to understand, because you manually set $_SESSION['login_url'] and $_SESSION['logout_url'] so it mess things up.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: ms_ukyankee on April 14, 2006, 11:08:10 PM
Quote from: yellow1912 on April 14, 2006, 10:32:03 PM
Well, it's easy to understand, because you manually set $_SESSION['login_url'] and $_SESSION['logout_url'] so it mess things up.

SMF should be resetting the correct login url, it always has before for my other installations.

If I'm not mistaken, it should be done here in LogInOut.php, last line, unset login url. I can't work out why it's not.

// Set the login URL - will be used when the login process is done.
if (isset($_SESSION['old_url']) && preg_match('~(board|topic)[=,]~', $_SESSION['old_url']) != 0)
$_SESSION['login_url'] = $_SESSION['old_url'];
else
unset($_SESSION['login_url']);
}


Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: ms_ukyankee on April 14, 2006, 11:17:24 PM
I've turned off database driven sessions and that's solved my problem, thanks.

Actually it didn't. I think perhaps using the api with ssi was causing session issues, but I've sorted it by putting $_SESSION['login_url']=$scripturl; in the boardindex.template.php, and for logout as well.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Crimm on May 10, 2006, 11:50:26 AM
Okay, I know this thread is old, and has been bounced around a bit. But I figured it would be best to ask questions in here, instead of starting a new thread.  If that was a bad idea, I'll just start a new one.

Anywho, I'm having trouble with this, as a login.  What I have done is I have been given the task of setting up an internal site for keeping up with timesheets, and whatnot. So I decided the best way to go would be a joomla/smf bridge.  So far that setup is all working correctly.  Now I can't show you the site, since its firewalled off, but I can describe whats going on the best I can.

What I did, was I editted the joomla bridge login and the /SMF/index.php to have:


$URL = "https://192.168.220.35:444/login.php";
header ("Location: $URL");


I put this where the kickguest function is being called in index.php. This way noone can go to the forums, unless they are logged in. Two things to note:

1. Yes I know that is a private IP I'm referencing. Because we haven't DNS'ed it yet, because the original internal site is currently runnning, so I'm using IP's to test.
2. Notice that I'm trying to use SSL. Which I have gotten working with joomla/smf and the bridge just fine.

With this in there, noone can navigate the site at all, without being logged in.

Now my login.php is written as:

<?php
require('/forums/SSI.php');
if (
$context['user']['is_guest'])
{
echo 
'Please Login';
$_SESSION['login_url'] = 'https://192.168.220.35:444/core/';
ssi_login();
}
else
{
ssi_welcome();
ssi_logout($_SESSION['logout_url']);
}


Basically if the user isn't logged on, I want them directed back to the login.php. No questions asked.  Now I have written plenty of code in the day, but I have never tried to use the SSI.php functions. But I like it, so let me tell you guys thank you for having this included in the forums VERY nice.  Now whats happening is, when I type a valid logon username/password ... it does nothing but refreshes the page. No errors, nothing. Same thing for a invalid username/password.

I have even tried editting LogInOut.php like suggested above... Nothing. I have tried every single thing I can find on google, this thread, and by searching the forums.  I know its something stupid I'm missing, but I just can't see it.

Any ideas?  PLEASE :D

Current Configuartions:
1. IIS 6.0 on Windows 2003 Server
2. php 5.1.2
3. MySQL 4 (Make a long story short, its a fix from a mySQL/Joomla bug)
4. Joomla is located in folder /core/
5. SMF is at /forums/
6. Joomla 1.0.8
7. Latest SMF (downloaded last week)
8. Latest Bridge
9. Everything works if I use the joomla module login. I had to do some tweaking with it though on the logout. It wasn't logging out correctly, so I made it use ssi_logout, instead of what it was using.

My only problem is that when I try to use a custom login page, the login goes nowhere, it just refreshes itself and sits there. 

*And by the way, I'm using a new laptop, so my typing on this new k/b is less than desired. I
proof-read but if I missed anything, excuse the mess :P

Thank you for all of your help!
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Jim R on July 16, 2006, 10:37:58 PM
Having read through all of the posts, none of this is working as I'd like it to work.  Here is what I'm using:


<?php
require("/home/jwrbloom/public_html/smf/SSI.php"); 
$_SESSION['login_url'] = 'http://www.hoosierhoopsreport.com' $_SERVER['PHP_SELF'];
?>



That's at the top of my page.  It works OK on the surface.  User logs in.  User returns to page he logged in from.  However, upon logging out and trying to log back in at my forum's index page, I'm taken back to the page where I logged in the first time.

So I start over.  This time I log into the forum index page first.  I return to that page.  I log out.  I go to another page and log in, but I'm returned to the forum index page.


Did I read something in another topic where you "reset" the login_url?

Thanks.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Inque187 on August 21, 2006, 03:42:03 AM
I think my SSI.php file is broken. I upgraded from SMF 1.0.7  to SMF 1.1 RC2. Every time I add the code to check if a user is logged into the forums, It keeps telling me that the user is a Guest and is not logged in. I know I am logged into my forums as well but it still says that i am a guest.

http://www.fbi-clan.org/portal.php

Here is my code:

<?php
error_reporting
(0);
include (
'/home/fbiclan3/public_html/forums/SSI.php');
ssi_welcome();
ssi_login('http://www.fbi-clan.org/portal.php');
$_SESSION['login_url'] = 'http://www.fbi-clan.org/portal.php' $_SERVER['PHP_SELF'];
?>


I am also redirected to the forum index page and not my portal page.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: nend on August 31, 2006, 10:28:32 PM
Quote from: Rickc on December 09, 2004, 04:46:50 PM
Now is there a way to add it so that the user goes to the /forum/index.php?action=login, then once they log in, it shoots them back to where they were before?

Maybe with a link

<img border="0" OnClick="history.go(-2)" src="click_here_to_go_back_to_page_image.png" Title="Back">

This will take them two pages back on click.  But then again they will still have to refresh page because it will load the browsers cache and still look like they are logged out even though they just logged in.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Markuz Nightwind on December 11, 2006, 10:11:30 AM
After reading all the posts, it still doesn't work for me using 1.1 final, seems like ssi_login in session isn't reseted :( Anyone can help pls?
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: arabiancoder on December 26, 2006, 10:18:32 AM
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!
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: dichterDichter on January 25, 2007, 12:43:06 PM
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 ?
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: dichterDichter on January 26, 2007, 12:34:02 PM
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 : http://www.hfg-forum.de

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.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: d03boy on February 07, 2007, 09:42:17 PM
<?php
if ($context['user']['is_guest']) {
echo '<div id="loggedOutDiv">';
$_SESSION['login_url'] = 'http://neweragaming.org' $_SERVER['PHP_SELF'];
ssi_login();
echo '</div>';
}
else {
echo 
<div id="loggedIn">
Welcome, ' 
$context['user']['name'] . '
<br />
'
;
$_SESSION['logout_url'] = 'http://neweragaming.org' $_SERVER['PHP_SELF'];
ssi_logout();
echo '
</div>
'
;
}
?>


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)
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: SubCog on February 14, 2007, 12:02:03 AM
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.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: semaj4712 on February 20, 2007, 02:32:25 PM
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
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: SubCog on February 25, 2007, 01:53:43 AM
does anyone know if this issue is being addressed in the next version?
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: SubCog on March 22, 2007, 12:59:41 PM
bump.

c'mon, somebody's gotta have a solution for this problem, right?
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: sjaguar13 on April 03, 2007, 06:52:41 PM
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.
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: lanB on April 18, 2007, 10:00:21 AM
I have tried most of the advice in earlier posts and still haven't resolved my problem which is...

I have a website;
&nbsp; www.mysite.com
There is a download page;
www.mysite.com/test.php
I have SMF forum at;
www.mysite.com/forum/

Users arrive at my site at;
www.mysite.com/index.html
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!
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: lanB on April 18, 2007, 11:37:27 AM
I have found a solution which almost works...

I have added a link in my forum to be able to switch back...
<a href="http://www.mysite.co.uk/forum/testfile.php">testfile</a>

the code for my testfile.php is...
<?php
require_once("/home/httpd/vhosts/mysite.co.uk/httpdocs/forum/SSI.php");
  ssi_login();
   
   ssi_whosOnline();   
   $_SESSION['login_url'] = 'http://www.mysite.co.uk' . $_SERVER['PHP_SELF'];   
   $_SESSION['logout_url'] = 'http://www.mysite.co.uk' . $_SERVER['PHP_SELF'];   
   ssi_logout();            
?>
<html>
<head><title>test file</title></head>
<body>
downloads
<a href="http://www.mysite.co.uk/forum/index.php">forum</a>

</body>
</html>
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?
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: rotterweil on April 22, 2007, 11:16:30 AM
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:

www.dummysite.com/forum/index.php?theredirecturl.php

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:

redirectexit("whateverurl.php");

This seems to work for logout.

Now just for login....
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: xiuide on May 10, 2007, 03:38:35 PM
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 http://mysite.com/forum/index.php?action=login2 but then when it comes back to http://mysite.com/index.php 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:
<?php
if ($user_info['is_guest'])
{
 
$_SESSION['login_url'] = 'http://mysite.com/index.php';
 ssi_login(); ?>
<br />
     <?php
}
else
{

 
$_SESSION['logout_url'] = 'http://mysite.com/index.php';
ssi_logout(); 

?>


I have also tried this:
<?php
 $_SESSION
['login_url'] = 'http://thegodsofwar.us/index.php';
 ssi_login(); ?>

<br />
     <?php $_SESSION['logout_url'] = 'http://thegodsofwar.us/index.php';
ssi_logout(); 
?>
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: metallica48423 on May 10, 2007, 11:22:45 PM

<?php
if ($context['user']['is_guest']) {
 
$_SESSION['login_url'] = 'http://mysite.com/index.php';
 ssi_login(); 
         echo 
'<br />';
}

else {
 
$_SESSION['logout_url'] = 'http://mysite.com/index.php';
ssi_logout(); 

?>



Also, have you tried:

ssi_login(http://mysite.com/index.php);?
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: 96lude on November 22, 2007, 12:04:54 AM
ok,   i have a site    ('www.mysite.com')   and the smf forums    ('forums.mysite.com')     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
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Cheffu on December 07, 2007, 11:24:35 AM
Hello,
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 http://www.bgb08.de/fertig2/ (http://www.bgb08.de/fertig2/). 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?

Regards,
Cheffu
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: arcardenas on December 13, 2007, 10:52:01 PM
nvm, it's wroking now  :-X
Title: Re: HowTo redirect the login or logout url with ssi_login resp. ssi_logout
Post by: Sarge on December 16, 2007, 03:12:24 AM
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.