Hello.
How can i restrict the access to the Roster to phpbb2 registered users only ?
We do not want to let unregistered visitors see each and every aspect of our Chars.
<?php
define('IN_PHPBB', true);
$phpbb_root_path = '../../'; //<--
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
include('update2.'.$phpEx);
?>
// Start phpBB TS Viewer Mod
if ($userdata['session_logged_in']) {}
else {
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title> Roster</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFF99">
<p align="center"> </p>
here your html text for the login information (i dont post mine here because i have german text)
</body>
</html>';
exit();
}
Nomad_Wanderer wrote:This doesn't protect the roster, this protects the upload page. Correct?
1. Limit who can even see the data at all
2. Limit who can see Guild Bank information
3. Limit it so Bag/Mail/Bank/Gold information is limited to the players characters only. (this sould be private infromation)
<?
include("include/session.php");
if($session->logged_in){
echo "You are viewing the protected page";
}
else{
echo "You are not allowed to view this page";
}
?>
switch ($action)
{
case 'character':
$char->out();
break;
case 'bags':
if( $roster_conf['show_inventory'] == 1 )
{
if($session->logged_in){
$bag0 = bag_get( $char, 'Bag0' );
if( !is_null( $bag0 ) )
echo $bag0->out();
$bag1 = bag_get( $char, 'Bag1' );
if( !is_null( $bag1 ) )
echo $bag1->out();
$bag2 = bag_get( $char, 'Bag2' );
if( !is_null( $bag2 ) )
echo $bag2->out();
$bag3 = bag_get( $char, 'Bag3' );
if( !is_null( $bag3 ) )
echo $bag3->out();
$bag4 = bag_get( $char, 'Bag4' );
if( !is_null( $bag4 ) )
echo $bag4->out();
$bag5 = bag_get( $char, 'Bag5' );
if( !is_null( $bag5 ) )
echo $bag5->out();
}
}
break;
case 'bank':
if( $roster_conf['show_bank'] == 1 )
{
if($session->logged_in){
$bag0 = bag_get( $char, 'Bank Contents' );
if( !is_null( $bag0 ) )
echo $bag0->out();
$bag1 = bag_get( $char, 'Bank Bag1' );
if( !is_null( $bag1 ) )
echo $bag1->out();
$bag2 = bag_get( $char, 'Bank Bag2' );
if( !is_null( $bag2 ) )
echo $bag2->out();
$bag3 = bag_get( $char, 'Bank Bag3' );
if( !is_null( $bag3 ) )
echo $bag3->out();
$bag4 = bag_get( $char, 'Bank Bag4' );
if( !is_null( $bag4 ) )
echo $bag4->out();
$bag5 = bag_get( $char, 'Bank Bag5' );
if( !is_null( $bag5 ) )
echo $bag5->out();
$bag6 = bag_get( $char, 'Bank Bag6' );
if( !is_null( $bag6 ) )
echo $bag6->out();
}
}
break;
case 'quests':
if( $roster_conf['show_quests'] == 1 )
echo $char->show_quests();
break;
case 'recipes':
if( $roster_conf['show_recipes'] == 1 )
print $char->show_recipes();
break;
case 'bg':
if ( $roster_conf['show_bg'] == 1 )
{
$url .= '&action=bg';
echo $char->show_pvp2('BG', $url, $sort, $start);
}
break;
case 'pvp':
if( $roster_conf['show_pvp'] == 1 )
{
$url .= '&action=pvp';
echo $char->show_pvp2('PvP', $url, $sort, $start);
}
break;
case 'duels':
if( $roster_conf['show_duels'] == 1 )
{
$url .= '&action=duels';
echo $char->show_pvp2('Duel', $url, $sort, $start);
}
break;
case 'spellbook':
if( $roster_conf['show_spellbook'] == 1 )
{
$url .= '&action=spellbook';
echo $char->show_spellbook();
}
break;
case 'mail':
if( $roster_conf['show_mail'] == 1 )
{
if($session->logged_in){
$url .= '&action=mail';
echo $char->show_mailbox();
}
}
break;
default:
$char->out();
break;
}
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'] )
{
//
// Begin page access based on group membership
//
$groupid=420; // ID of group which can enter
$groupid2=557; // ID of group which can enter
$us_id=$userdata['user_id']; //ID of the current logged in user
$sql = "SELECT group_id,user_id
FROM phpbb_user_group
WHERE (group_id=".$groupid." OR group_id=".$groupid2.") AND user_id=".$us_id;
if( !($result = $db->sql_query($sql)) ) {
message_die(GENERAL_ERROR, 'Could not Check for group membership', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
if ($row['user_id']=='') {
message_die(GENERAL_ERROR, 'Sorry, this page is reserved for [u]put your stuff here[/u],
login at (http://www.yourwebpagehere/)', 'http://www.yourwebpagehere', '', '', '');
}
//
// End page access based on group membership
//
} else
{
$URL="http://www.yourwebpagehere/phpBB2/login.php";
header ("Location: $URL");
}
duromiir wrote:Hey Sunstrider,
I tried inserting the code you posted like this
<?php
{your first block of code}
{original code}
{your second block of code}
?>
What's happening is that I'm being bounced back to the forums when I click on the character links in the forum. Am I doing something wrong?
Sunstrider wrote:phpbb forum code already has a message_die function, wowroster 1.7.2 has now added a function with the same name. I had to edit all the wowroster code and change message_die to message_die2 for my site, this allowed my workaround to continue without any other changes.
I'm using it in production now without any problems.
Users browsing this forum: No registered users and 0 guests