Page 1 of 2

Logout Redirect

Posted: Thu Jun 19, 2008 3:25 am
by Litterbox
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?

Re: Logout Redirect

Posted: Thu Jun 19, 2008 3:30 am
by ric323
Read the paragraph under "How Do I make a logout Link?" in Knowledge Base - phpBB2 Sessions Integration

Re: Logout Redirect

Posted: Thu Jun 19, 2008 4:13 am
by Litterbox
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.

Re: Logout Redirect

Posted: Sun Jun 22, 2008 1:01 am
by Litterbox
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.

Re: Logout Redirect

Posted: Sun Jun 22, 2008 1:41 am
by Lumpy Burgertushie
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>');
    }

    ?>

Re: Logout Redirect

Posted: Sun Jun 22, 2008 4:22 am
by Litterbox
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.

Re: Logout Redirect

Posted: Sun Jun 22, 2008 5:46 am
by Lumpy Burgertushie
I don't really see anything wrong with it.

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

robert

Re: Logout Redirect

Posted: Sun Jun 22, 2008 7:11 am
by Litterbox
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.

Re: Logout Redirect

Posted: Sun Jun 22, 2008 7:30 am
by ric323
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.

Re: Logout Redirect

Posted: Sun Jun 22, 2008 8:14 am
by Litterbox
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/

Re: Logout Redirect

Posted: Sun Jun 22, 2008 8:54 am
by ric323
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.

Re: Logout Redirect

Posted: Sun Jun 22, 2008 10:23 pm
by Litterbox
My Suggested Cookie Settings:
  • : cpnguild.runhost.net
  • : 80
  • : /
  • :
  • : cpnguild.runhost.net
  • : /
  • : phpBB2_forum
  • : 3600
  • : Yes
  • : 0
My Current Cookie Settings:
  • :
  • :
  • :
  • :
  • :
  • :
  • :
  • :
  • :
  • :

Re: Logout Redirect

Posted: Sun Jun 22, 2008 10:42 pm
by ric323
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?

Re: Logout Redirect

Posted: Sun Jun 22, 2008 11:02 pm
by Litterbox
cpnguild.runhost.net/forums/

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

Re: Logout Redirect

Posted: Mon Jun 23, 2008 2:26 am
by Litterbox
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.