phpbb login.php problem

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
bullet-worm
-


Joined: 05 Aug 2004
Posts: 6

PostPosted: Tue Sep 07, 2004 7:30 pm    Post subject: phpbb login.php problem Reply with quote

I have forums set up and working nicely... well, almost nicely....

The forums work. Completely. EXCEPT, when you login in, you get back a "This Page Cannot Be Found" error. However, if you return to the index after logging in and getting the error page, you ARE logged in.

Also, when you attempt to log out, it does the same thing.

If you use the url it is calling for WHILE logged in, you get the error page. If you use the url while not logged in, you get to the login screen. ?!?

I am lost and confused. I am assuming the problem is somewhere in the login.php file itself, like it is attempting to redirect to someplace unknown.

Anyone seen this before? Any help / ideas would be appreciated. If you want to see the problem for yourself:
www.wormsworld.net/forums/index.php

Thanks!

worm
Back to top View user's profile Send private message
k1ll3rdr4g0n
-


Joined: 04 Jul 2004
Posts: 609

PostPosted: Tue Sep 07, 2004 11:05 pm    Post subject: Reply with quote

phpBB has this problem, goto their website and search for it under help or something. It deals with replacing a meta refresh i believe. (woah almost wrote meat instead ot meta.)
_________________
Back to top View user's profile Send private message AIM Address
bullet-worm
-


Joined: 05 Aug 2004
Posts: 6

PostPosted: Wed Sep 08, 2004 2:43 pm    Post subject: Reply with quote

Thanks! Turned out to be a config problem. Found this helper .php file that sets up the config for you and it fixed my problem! VERY useful for those of us who do not FULLY understand all this terminology.

1) Copy this code into an empty text file and rename the file to cookie.php.
Quote:
<?php
// Written by A_Jelly_Doughnut and geocator, extras added by Shof515

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

include($phpbb_root_path . 'includes/page_header.'.$phpEx);

if ($_POST['action'] == "write")
{
$sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $_POST['cookie_domain'] . "' WHERE config_name = '" . cookie_domain . "'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Failed to update");
}
$sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $_POST['cookie_path'] . "' WHERE config_name = '" . cookie_path . "'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Failed to update");
}
$sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $_POST['cookie_name'] . "' WHERE config_name = '" . cookie_name . "'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Failed to update");
}
$sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $_POST['domain_name'] . "' WHERE config_name = '" . server_name . "'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Failed to update");
}
$sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $_POST['script_path'] . "' WHERE config_name = '" . script_path . "'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Failed to update");
}
$sql = "UPDATE " . CONFIG_TABLE . " SET config_value = '" . $_POST['server_port'] . "' WHERE config_name = '" . server_port . "'";
if( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Failed to update");
}
echo ('<p><b>Settings sucessfully updated</b></p>');
echo ('<p><b>Please delete this script now!</b></p>');
}
else
{

$file_path = $HTTP_SERVER_VARS['SCRIPT_NAME'];
$dirs = explode('/', $file_path);
$dir_count = count( $dirs ) - 1;
unset( $dirs[$dir_count] );
$script_path = implode( '/', $dirs) . '/';

$server_port = $HTTP_SERVER_VARS['SERVER_PORT'];

$server_name = $HTTP_SERVER_VARS['SERVER_NAME'];


if (strstr($server_name, "www."))
{
$cookie_domain = substr($server_name, 3);
}
else
{
$cookie_domain = $server_name;
}



$cookie_path = substr($script_path, 0, -1);

if (strlen($cookie_path) == 0)
{
$cookie_path = "/";
}

$cookie_name = substr($cookie_domain, 1, 4) . substr($cookie_path, 1, 4) . '_phpbb';
echo('<span class="nav">The following settings have been auto-detected and should be fine. If you wish you may change them and then write all the info to your database.');
echo('<table class="genmed">');
echo('<form method="post" action="' . $_SERVER['PHP_SELF'] . '">');
echo('<tr><td>Cookie Domain: </td><td><input type="text" name="cookie_domain" value="' . $cookie_domain . '"></td></tr>');
echo('<tr><td>Cookie Path: </td><td><input type="text" name="cookie_path" value="' . $cookie_path . '"></td></tr>');
echo('<tr><td>Cookie Name: </td><td><input type="text" name="cookie_name" value="' . $cookie_name . '"></td></tr>');
echo('<br />');
echo('<tr><td>Domain Name: </td><td><input type="text" name="domain_name" value="' . $server_name . '"></td></tr>');
echo('<tr><td>Script Path: </td><td><input type="text" name="script_path" value="' . $script_path . '"></td></tr>');
echo('<tr><td>Server Port: </td><td><input type="text" name="server_port" value="' . $server_port . '"></td></tr>');
echo('</table>');
echo('<input type="hidden" name="action" value="write">');
echo('<input type="submit" value="Write to DB">');
echo('</form>');

}

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>


2) Upload the file to your phpbb folder (the MAIN phpbb folder where index.php and login.php can be found).

3) Web-browse from a remote machine to the cookie.php file. A page should come up with the settings that the code thinks you should have for your phpbb configuration.

4) Click on the 'Write to Database' if you want to save the config info to your database.

5) Remove the cookie.php file (could be a potential security issue)

It worked for me! Just thought I would share my findings. And many thanks to A_Jelly_Doughnut, geocatorand Shof515 for the code!!!
Back to top View user's profile Send private message
k1ll3rdr4g0n
-


Joined: 04 Jul 2004
Posts: 609

PostPosted: Wed Sep 08, 2004 7:28 pm    Post subject: Reply with quote

Yep thats it :D.
_________________
Back to top View user's profile Send private message AIM Address
Eldrin
-


Joined: 10 Oct 2004
Posts: 8

PostPosted: Mon Oct 11, 2004 3:56 pm    Post subject: Reply with quote

i trid this, it did work, but when i move form my portal to my index it logs me out. this is incredible annoying.
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group