All pastes #268529 Raw Edit

Mine

public php v1 · immutable
·published 2006-12-05 20:11 UTC
rendered paste body
<?php // standard hack prevent define('IN_PHPBB', true);$phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc');include($phpbb_root_path . 'common.'.$phpEx);//get string from URL, member id$id = mysql_escape_string($_GET['id']);//// Start get all authorised users and their info//// Get all authorised users, when all registered users may play games (no particular order)$auth_users = array();if ( $board_config['games_auth_mode'] == '1' ){	$order_by = "user_id";	$auth_users = get_users_ids($order_by);}// Get all authorised users, when only 1 (or more) group(s) may play gameselse if ( $board_config['games_auth_mode'] == '2' ){	// Get authorised groups	$sql = "SELECT group_id 		FROM " . GROUPS_TABLE . " 		WHERE group_auth_games = 1";	if ( $result = $db->sql_query($sql) )	{		$auth_group_ids = array();		while ( $row = $db->sql_fetchrow($result) )		{			$auth_group_ids[] = $row['group_id'];		}	}	// Get users who are in an authorised group	if ( !empty($auth_group_ids) )	{		for($i = 0; $i < count($auth_group_ids); $i++)		{			$sql = "SELECT user_id 				FROM " . USER_GROUP_TABLE . " 				WHERE group_id = " . $auth_group_ids[$i];			if ( $result = $db->sql_query($sql) )			{				while ( $row = $db->sql_fetchrow($result) )				{					// Add user if he is not yet in the array of authorised users (prevent adding twice)					$add = '1';					for($j = 0; $j < count($auth_users); $j++)					{						if ( $row['user_id'] == $auth_users[$j] )						{							$add = '0';						}					}					if ( $add == '1' )					{						$auth_users[] = $row['user_id'];					}				}			}		}	}}// Give error message when no users are authorised to play games (nothing to display)if (count($auth_users) == 0){	message_die(GENERAL_MESSAGE, $lang['Games_No_Auth_Users'] );}// Select all authorised users and all available gamers$j = 0;for($i = 0; $i < count($auth_users); $i++){	if ($i == 0)	{		$sql_where = "user_id = " . $auth_users[$i];	}	else	{		$sql_where .= " OR user_id = " . $auth_users[$i];	}	if ( $userdata['user_id'] != $auth_users[$i] )	{		if ($j == 0)		{			$sql_2_where = "user_id = " . $auth_users[$i];			$j++;		}		else		{			$sql_2_where .= " OR user_id = " . $auth_users[$i];		}	}}// Get all info of authorised users$sql = "SELECT * 	FROM " . USERS_TABLE . " 	WHERE " . $sql_where . "	ORDER BY games_points DESC, games_won DESC, games_lost ASC, username";if ( $result = $db->sql_query($sql) ){	$auth_users_info = array();	while ( $row = $db->sql_fetchrow($result) )	{		$auth_users_info[] = $row;	}}//END GET INF0Zfor ($i = count($auth_users_info); $i > 0; $i--){	$rank = $i - 1;	if($auth_users_id[$i]['user_id'] == $id) break;}echo 'User #'.$id.' has '.$points.' points, and is ranked #'.$rank;?>