Extra pages in 3.0.4

Discussion of general topics related to the new version and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Forum rules
Discussion of general topics related to the new release and its place in the world. Don't discuss new features, report bugs, ask for support, et cetera. Don't use this to spam for other boards or attack those boards!
Post Reply
chew
Registered User
Posts: 6
Joined: Tue Feb 10, 2009 6:15 pm

Extra pages in 3.0.4

Post by chew » Fri Feb 13, 2009 10:58 am

I recently took over the maintenance of a board that is running 3.0.0 and so to get myself upto speed and to give me the chance to make sure an upgrade to 3.0.4 would go smoothly I have setup a copy as a test environment. Yesterday I performed the upgrade as advised by you good people and it worked a treat!

The only exception is with a custom page the site has for a chat functionality. The previous tech admin set the page up and it works fine on 3.0.0. The code for the php page is as follows:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

page_header('ReefSafe Chat');

if (!$user->data['is_registered'])
{
  trigger_error('You are not allowed to enter the chat-room.');
}

$naam = $user->data['username'];

$template->set_filenames(array(
    'body' => 'chat.html',
));

$template->assign_vars(array(
                'naam'  => $naam));

page_footer();
?>
When I try access the page on the test site now I simply get the message 'You are not allowed to enter the chat-room' and it appears to have logged me out of the rest of the board. I can log in to the rest of the board again but everytime I visit this page I get logged out again. The only things I can think of is there has been some change to security between these 2 versions or that I need to re-register the page somewhere but if this is the case I can't find where.

Any help greatfully received!

User avatar
Lumpy Burgertushie
Registered User
Posts: 1006
Joined: Tue Feb 28, 2006 5:26 pm

Re: Extra pages in 3.0.4

Post by Lumpy Burgertushie » Fri Feb 13, 2009 4:05 pm

there were quite a few code changes since your version, one or more may have affected this for you.

this is the current code needed to create a custom page.
http://www.phpbb.com/kb/article/add-a-n ... -to-phpbb/

luck,
robert

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: Extra pages in 3.0.4

Post by Acyd Burn » Fri Feb 13, 2009 4:36 pm

The page should still work fine... you did a print_r($user->data) before the if statement to see the user data used?

Image

chew
Registered User
Posts: 6
Joined: Tue Feb 10, 2009 6:15 pm

Re: Extra pages in 3.0.4

Post by chew » Fri Feb 13, 2009 6:02 pm

Acyd Burn wrote:The page should still work fine... you did a print_r($user->data) before the if statement to see the user data used?
I get a an array of user data back. Critically the username is Anonymous.

I've looked through the details of how to create a page too and I can't see that I'm doing anything wrong in the code.

User avatar
Acyd Burn
Posts: 1838
Joined: Tue Oct 08, 2002 5:18 pm
Location: Behind You
Contact:

Re: Extra pages in 3.0.4

Post by Acyd Burn » Sat Feb 14, 2009 2:46 pm

If it is the anonymous user then obviously the user accessing the page is not logged in or looses the session (if cookies are disabled the ?sid= is appended. If you do not link to the page with append_sid() the sid is no longer appended and the session will be lost resulting in going back to the anonymous user, even if you were logged in before).

Image

chew
Registered User
Posts: 6
Joined: Tue Feb 10, 2009 6:15 pm

Re: Extra pages in 3.0.4

Post by chew » Sun Feb 15, 2009 11:40 am

You were right the test site was for some reason failing to save the cookie and so was using ?sid= instead. I can only assume this was because it was conflicting with the live site cookie. I changed the code to use append_sid() and that worked a treat and I also sorted the cookie issue buy changing the domain of the test site cookie!

Thanks again for the help!

Post Reply