Jump to content

Recommended Posts

Ok. I found the info to create custom pages and add them onto the forum. But I want to add to the code on that page to check if the user is registered. I had figured out once a while back what code peaces to use but I lost the info and it is not on here any more.  :( If someone either has that or can help me out that would be great cause honestly I don't remember how I managed to do it LOL.

Here is the page I found and downloaded to add in custom pages:

 

<?

/-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=

*                                info.php

*                            -------------------

*  author   : Roy Dings (Lithium

*  email                : XGE_Lithium@hotmail.com

*

***************************************************************************/

 

/***************************************************************************

*

*  This program is free software; you can redistribute it and/or modify

*  it under the terms of the GNU General Public License as published by

*  the Free Software Foundation; either version 2 of the License, or

*  (at your option) any later version.

*

***************************************************************************/

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

//

  //

  // Start output of page

  //

  $page_title = $lang['Index'];

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

 

  $template->set_filenames(array(

      'body' => 'info_body.tpl')

  );

 

//

// Generate the page

//

$template->pparse('body');

 

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

 

 

?>

 

 

I figure someplace right after the end session management I need to add this code in.

Thanks

Link to comment
https://forums.phpfreaks.com/topic/55954-adding-a-custom-page-to-phpbb/
Share on other sites

  • 2 weeks later...

64 people have looked at this and no one has an idea??? *sigh* guess I am in the same boat as last time and will have to do it on my own again which took me weeks to figure out. I had hoped I could get this taken care of sooner as I kinda need it asap. thanks anyway I guess. =(

  • 2 weeks later...

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './phpBB2/';
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'] and $userdata['user_active']=1)
{
echo('Hi ' . $userdata['username'] . '!');
}
else
{
echo"Not authorized";
exit();
}

?>

 

Here is the code I use at the top of all my pages using the phpbb login system.  "user_active" is the field that lets you know if someone is registered, 0 for no and 1 for yes. This may or may not work, since I'm new that "=1" may be a problem, leave it out if it is. On the script I use I check that they are logged in AND what their user level is before displaying something rather than logged in and registered. User level being a field I added myself.

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.