Jump to content

[SOLVED] PHPBB Fetch All


cheechm

Recommended Posts

Hi,

I have PHP Fetch ALl and I was wondering s it possible to have proected pages which can be visted if you log in to the forums? Or vice versa. I know PHPNuke kinda does this, but I don't want to use it. I literally want to use the PHPBB database

Would this code work?

  [code]  php:<?php
    if ($userdata['username'])
    {
    // Logged in content here
    }
    else
    {
    // Not logged in content here
    }
    ?>[/code]



Thanks
Link to comment
Share on other sites

The idea will work, but just checking if username is set may not be the best way to do it. You might get positive matches on banned users.

You actually don't even need PHPBB Fetchall. I do it on my site just with this:
[code=php:0]
define('IN_PHPBB', true);
$site_root_path = ""; //<-- Modify
$phpbb_root_path2 = 'forum/'; //<-- Modify
$phpbb_root_path = $site_root_path . $phpbb_root_path2;
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.php');
include($phpbb_root_path . 'config.php');
$userdata = session_pagestart($user_ip, PAGE_INDEX);
[/code]

It should return that same array.

You can var_dump($userdata) to see what each switch in the array is set to. I would try it with a banned user, a guest, and a normal user account.

I'm using if($userdata['user_active'] == 1) for my user only content, and it seems to work fine.
Link to comment
Share on other sites

Yes. It might be easier to put it in a single file, then include it every time you need it.

You can actually make your own login page that uses the phpbb login script. There's a post var that you can set to redirect to any page on your site.

http://www.phpbb.com/kb/article.php?article_id=216
Link to comment
Share on other sites

I have just been playing around with it.

??? ??? ???

I can't get it to work.

I login into the forums and then visit the page with the include in it. I have protection.php written and saved it. But when I visit it, it doesn't seem to protect the page.

The forum is located here:

htdocs/forum

The protected pages are located here:

htdocs/account

What is the problem?
Thanks

BTW
I have done the redirect easily though. That helped a bunch!
Link to comment
Share on other sites

  • 4 weeks later...
This is an old thread, so I'm not sure if you ever figured it out, but you need to define the php path vars correctly for your installation.

Remeber that as soon as you go in to /account, the forum path will change to ../forum/, because you have to step down a directory.

Try saving this as a file and putting it in /account.
[code]
<?php
define('IN_PHPBB', true);
$site_root_path = ""; //<-- Modify
$phpbb_root_path2 = '../forum/'; //<-- Modify
$phpbb_root_path = $site_root_path . $phpbb_root_path2;
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.php');
include($phpbb_root_path . 'config.php');
$userdata = session_pagestart($user_ip, PAGE_INDEX);

var_dump($userdata);
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.