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

ajnus


<?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 [nofollow] but when i click login it always ends up at http://mysite.com/forum/index.php [nofollow]


andrea

Use the commands precisely as they are in the 1st post of this thread.

Andrea Hubacher
Ex Lead Support Specialist
www.simplemachines.org

Personal Signature:
Most recent work:
10 Aqua Themes for SMF



ajnus


<?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 [nofollow] 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 [nofollow]. I think the code is exactly the same as the 1st post of this thread? or am i doing something wrongly  :(

NukeWorker.com

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.

juncmodule

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

[Unknown]

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]

juncmodule

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

rmnoonan

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

HoTmetal

Yeah, I'm having the same problem too. Though I think mine may be server related (I"m not sure)

juncmodule

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

andrea

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).

Andrea Hubacher
Ex Lead Support Specialist
www.simplemachines.org

Personal Signature:
Most recent work:
10 Aqua Themes for SMF



juncmodule

Sorry about the no link thing:

hxxp:www.juncmodule.com/login.php [nonactive]

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

costanza

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.

andrea

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.

Andrea Hubacher
Ex Lead Support Specialist
www.simplemachines.org

Personal Signature:
Most recent work:
10 Aqua Themes for SMF



HoTmetal

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

costanza

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.

WAC

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.

weekend camper

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"); 

HoTmetal

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

[Unknown]


Advertisement: