Logout Redirect

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Litterbox
Registered User
Posts: 18
Joined: Tue May 27, 2008 7:03 am

Logout Redirect

Post by Litterbox » Thu Jun 19, 2008 3:25 am

Hello. I am trying to intergrate a login screen with my website, but I'm running into a slight snag. I have a logout link when users are logged in, and I want that link to send you to my site, not the forums.

What do I need to change in order to make the logout link send me to my site?

User avatar
ric323
Former Team Member
Posts: 22909
Joined: Tue Feb 06, 2007 12:33 am
Location: Melbourne, Australia
Name: Ric
Contact:

Re: Logout Redirect

Post by ric323 » Thu Jun 19, 2008 3:30 am

Read the paragraph under "How Do I make a logout Link?" in Knowledge Base - phpBB2 Sessions Integration
The Knowledge Base contains solutions to many common problems!
How to fix "Doesn't have a default value" and "Incorrect string value: xxx for column 'post_text' " errors.
How to do a clean re-install of the latest phpBB3 version.
Problems with permissions? Read phpBB3 Permissions

Litterbox
Registered User
Posts: 18
Joined: Tue May 27, 2008 7:03 am

Re: Logout Redirect

Post by Litterbox » Thu Jun 19, 2008 4:13 am

Edit: I got it working for the most part. Part of my problem lied in not knowing where I was supposed to place the PHP tags. But once I sorted the head from the body, and the extra header modifiers (which produced an error every now and then) it seems to work. HOWEVER! I have another problem now.

I have my login script running, and it runs beautifuly. When I login, the window changes and my specified user information is displayed. When I logout, the window goes back to my main site. The problem? Internet explorer.

I can't get internet explorer to login. Whenever I try, it simply takes me to the phpbb2 login screen. (as if it's ignoring all the php at the end of the login url.)

Code: Select all

<?php

if($userdata['session_logged_in'])
{
echo('<b><font style="color:#FFFFFF;">Sup, <a href="forums/profile.php?mode=editprofile">'.$userdata['username'].'</a>&nbsp;&nbsp;&nbsp;');
echo('<b><font style="color:#FFFFFF;"><IMG src="images/mail.gif" border="0"> <a href="#">0</a> new messages</font></b>&nbsp;&nbsp;&nbsp;');
echo('<font><a href="' . append_sid($phpbb_root_path . 'login.php?logout=true&sid='.$userdata['session_id'].'&redirect=../controls.php') . '">Logout</a></font></b><font>');
}
else
{
echo('<form action="./forums/login.php" method="post" enctype="multipart/form-data"><B><font style="color:#FFFFFF;font-size:10px;">Name</font></B> <input type="text" name="username" size="8"><B><font style="color:#FFFFFF;font-size:10px;"> Pass</font></B> <input type="password" name="password" size="8"><input type="hidden" name="redirect" value="../controls.php"> <input type="image" src="images/submit.gif" value="login" name="login" style="vertical-align:bottom; id="submitbutton"></form>');
}

?>
I'm still working on the links and stuff in it, so some are either linking to the wrong thing, or not linked to anything.

Litterbox
Registered User
Posts: 18
Joined: Tue May 27, 2008 7:03 am

Re: Logout Redirect

Post by Litterbox » Sun Jun 22, 2008 1:01 am

I don't mean to seem impatient, or anything, but I'm really hoping that somebody out there can help shed some light as to why I can't log into my site using Internet Expolorer, but Firefox has no problems. Thanks.

User avatar
Lumpy Burgertushie
Registered User
Posts: 66488
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Logout Redirect

Post by Lumpy Burgertushie » Sun Jun 22, 2008 1:41 am

I am surprised that it works at all. you do not have any of the phpbb related stuff in the file.

it should look something like this:
( I also removed 4 blank lines from the top of the file. there must not be anything before the
opening <?php )

Code: Select all

<?php

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

    if($userdata['session_logged_in'])
    {
    echo('<b><font style="color:#FFFFFF;">Sup, <a href="forums/profile.php?mode=editprofile">'.$userdata['username'].'</a>&nbsp;&nbsp;&nbsp;');
    echo('<b><font style="color:#FFFFFF;"><IMG src="images/mail.gif" border="0"> <a href="#">0</a> new messages</font></b>&nbsp;&nbsp;&nbsp;');
    echo('<font><a href="' . append_sid($phpbb_root_path . 'login.php?logout=true&sid='.$userdata['session_id'].'&redirect=../controls.php') . '">Logout</a></font></b><font>');
    }
    else
    {
    echo('<form action="./forums/login.php" method="post" enctype="multipart/form-data"><B><font style="color:#FFFFFF;font-size:10px;">Name</font></B> <input type="text" name="username" size="8"><B><font style="color:#FFFFFF;font-size:10px;"> Pass</font></B> <input type="password" name="password" size="8"><input type="hidden" name="redirect" value="../controls.php"> <input type="image" src="images/submit.gif" value="login" name="login" style="vertical-align:bottom; id="submitbutton"></form>');
    }

    ?>
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

Litterbox
Registered User
Posts: 18
Joined: Tue May 27, 2008 7:03 am

Re: Logout Redirect

Post by Litterbox » Sun Jun 22, 2008 4:22 am

Sorry about that. Being new to PHP and all I forgot to post the entire document. I had the header information in there, and it's at the very top of my document, I just didn't think to post it.

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './forums/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
?>
<HEAD>
<TITLE>Login</TITLE>
<style>
body
{	background-color:98cfd6;color:#FFFFFF;}

font, table, td
{	color:black;font-family:tahoma;font-size:11px;}
a,a:active,a:visited
{	color:#206b70;font-weight:bold;text-decoration:none;}

a:hover
	{color:#000000;font-family:tahoma;font-size:11px;text-decoration:underline;}
input
{	color: #000000;
	background: #b8e3e8;
	border: 1px solid #ffffff;
	font-size : 10px;
	height: 16px;
#submitbutton
{	border: 5px solid #FFFFFF;
		height: 16px;
}
}
</style>
</HEAD>
<BODY bgcolor="#98cfd6" topmargin="0" rightmargin="0" bottommargin="0" leftmargin="0">
<DIV align="center">
<?php

if($userdata['session_logged_in'])
{
echo('<b><font style="color:#FFFFFF;">Sup, <a href="forums/profile.php?mode=editprofile">'.$userdata['username'].'</a>&nbsp;&nbsp;&nbsp;');
echo('<b><font style="color:#FFFFFF;"><IMG src="images/mail.gif" border="0"> <a href="#">0</a> new messages</font></b>&nbsp;&nbsp;&nbsp;');
echo('<font><a href="' . append_sid($phpbb_root_path . 'login.php?logout=true&sid='.$userdata['session_id'].'&redirect=../controls.php') . '">Logout</a></font></b><font>');
}
else
{
echo('<form action="./forums/login.php" method="post" enctype="multipart/form-data"><B><font style="color:#FFFFFF;font-size:10px;">Name</font></B> <input type="text" name="username" size="8"><B><font style="color:#FFFFFF;font-size:10px;"> Pass</font></B> <input type="password" name="password" size="8"><input type="hidden" name="redirect" value="../controls.php"> <input type="image" src="images/submit.gif" value="login" name="login" style="vertical-align:bottom; id="submitbutton"></form>');
}

?>
</DIV>
</BODY>
I've got my root path setup correctly, and that bit you'd mentioned is infact on the top of my page. Now that the entire code is up, does anything else seem out of place?

Thanks again for all the help.

User avatar
Lumpy Burgertushie
Registered User
Posts: 66488
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Logout Redirect

Post by Lumpy Burgertushie » Sun Jun 22, 2008 5:46 am

I don't really see anything wrong with it.

have you tried clearing your cookies and temporary internet files in IE ?

robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

Litterbox
Registered User
Posts: 18
Joined: Tue May 27, 2008 7:03 am

Re: Logout Redirect

Post by Litterbox » Sun Jun 22, 2008 7:11 am

Yeah. I've cleared cookies and deleted temporary files on IE and Firefox. Firefox still works perfectly, but Internet explorer always redirects to the phpBB login site, rather than actually using the login script, and then redirecting over to the user-info page I created.

Basically it works like this:
I see my login box.
I type in my username and password.
I hit enter.
I'm sent to the generic phpBB 2.0 login screen asking me to sign-in.

Now at this point I can sign in using the generic phpBB login, and then go back to my website, and refresh, which shows my information. Or just go back and not login at all in IE.

User avatar
ric323
Former Team Member
Posts: 22909
Joined: Tue Feb 06, 2007 12:33 am
Location: Melbourne, Australia
Name: Ric
Contact:

Re: Logout Redirect

Post by ric323 » Sun Jun 22, 2008 7:30 am

It sounds like there is a problem with your cookie settings.
Please run the Auto Cookie MOD (link in my sig) to check them.
It would also be useful to tell us the address of your board, so we can have a look.
The Knowledge Base contains solutions to many common problems!
How to fix "Doesn't have a default value" and "Incorrect string value: xxx for column 'post_text' " errors.
How to do a clean re-install of the latest phpBB3 version.
Problems with permissions? Read phpBB3 Permissions

Litterbox
Registered User
Posts: 18
Joined: Tue May 27, 2008 7:03 am

Re: Logout Redirect

Post by Litterbox » Sun Jun 22, 2008 8:14 am

I ran the Auto Cookie Mod thing, and it seems to have failed? I can't tell. I clicked the write changes button, and it just 404'd. So, I'm assuming it hit a snag. My cookies are configured to "/" already, like the tutorial said to do, so I'm not sure that cookies are the problem. But I honestly had no idea.

The forum is cpnguild.runhost.net/controls.php (that's my login-script)
My forums are at cpnguild.runhost.net/forums/

User avatar
ric323
Former Team Member
Posts: 22909
Joined: Tue Feb 06, 2007 12:33 am
Location: Melbourne, Australia
Name: Ric
Contact:

Re: Logout Redirect

Post by ric323 » Sun Jun 22, 2008 8:54 am

The Cookie MOD instructions request that you post the "Current" and "Recommended" settings here for review.
They are presented in a preformatted box at the foot of the screen when you run the MOD.
The Knowledge Base contains solutions to many common problems!
How to fix "Doesn't have a default value" and "Incorrect string value: xxx for column 'post_text' " errors.
How to do a clean re-install of the latest phpBB3 version.
Problems with permissions? Read phpBB3 Permissions

Litterbox
Registered User
Posts: 18
Joined: Tue May 27, 2008 7:03 am

Re: Logout Redirect

Post by Litterbox » Sun Jun 22, 2008 10:23 pm

My Suggested Cookie Settings:
  • : cpnguild.runhost.net
  • : 80
  • : /
  • :
  • : cpnguild.runhost.net
  • : /
  • : phpBB2_forum
  • : 3600
  • : Yes
  • : 0
My Current Cookie Settings:
  • :
  • :
  • :
  • :
  • :
  • :
  • :
  • :
  • :
  • :

User avatar
ric323
Former Team Member
Posts: 22909
Joined: Tue Feb 06, 2007 12:33 am
Location: Melbourne, Australia
Name: Ric
Contact:

Re: Logout Redirect

Post by ric323 » Sun Jun 22, 2008 10:42 pm

I am using IE7, and I cannot see any phpBB board there at all.
I'm browsing to http://cpnguild.runhost.net and just see a white page.
Viewing the HTML source just reveals:

Code: Select all

<! Placeholder !>
What is the actual address of your board?
The Knowledge Base contains solutions to many common problems!
How to fix "Doesn't have a default value" and "Incorrect string value: xxx for column 'post_text' " errors.
How to do a clean re-install of the latest phpBB3 version.
Problems with permissions? Read phpBB3 Permissions

Litterbox
Registered User
Posts: 18
Joined: Tue May 27, 2008 7:03 am

Re: Logout Redirect

Post by Litterbox » Sun Jun 22, 2008 11:02 pm

cpnguild.runhost.net/forums/

The index page is just a placeholder I put in there to get rid of the standard runhost welcoming page.

Litterbox
Registered User
Posts: 18
Joined: Tue May 27, 2008 7:03 am

Re: Logout Redirect

Post by Litterbox » Mon Jun 23, 2008 2:26 am

Edit: I was wondering, is it maybe because I didn't install the forums directly into the root, and instead put them in a "forums" directory? I followed that tutorial as best I could, so I'm not sure why it's not working...

Actual edit: Whoops, I thought I hit the edit button. Sorry about the double-post.

Locked

Return to “2.0.x Support Forum”