News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

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

arabiancoder

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!

dichterDichter

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 ?

dichterDichter

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

d03boy

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

SubCog

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.

semaj4712

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

SubCog

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

SubCog

bump.

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

sjaguar13

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.

lanB

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 [nofollow]
There is a download page;
www.mysite.com/test.php [nofollow]
I have SMF forum at;
www.mysite.com/forum/ [nofollow]

Users arrive at my site at;
www.mysite.com/index.html [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!

lanB

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 [nofollow]">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 [nofollow]' . $_SERVER['PHP_SELF'];   
   $_SESSION['logout_url'] = 'http://www.mysite.co.uk [nofollow]' . $_SERVER['PHP_SELF'];   
   ssi_logout();            
?>
<html>
<head><title>test file</title></head>
<body>
downloads
<a href="http://www.mysite.co.uk/forum/index.php [nofollow]">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?

rotterweil

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....
Life is either a great adventure or nothing.
- Helen Keller

xiuide

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 hxxp:mysite.com/forum/index.php?action=login2 [nonactive] but then when it comes back to hxxp:mysite.com/index.php [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:
<?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(); 
?>

metallica48423


<?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);?
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
Search
Settings Repair Tool

96lude

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

Cheffu

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

arcardenas

nvm, it's wroking now  :-X

Sarge

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.

http://www.zeriyt.com/   ~   http://www.galeriashqiptare.net/


Quote
<H> I had zero posts when I started posting

Advertisement: