All pastes #412058 Raw Edit

Unnamed

public php v1 · immutable
#412058 ·published 2007-03-27 13:43 UTC
rendered paste body
<?phpheader("Content-type: image/png");require('config.php');if (!mysql_connect($dbhost,$dbuser,$dbpasswd)){	die(mysql_error());}if (!mysql_select_db($dbname)){	die(mysql_error());}//get string from URL, member id$id = mysql_real_escape_string(intval($_GET['id']));$sql = "SELECT * FROM phpbb_users,grand_user_group	WHERE phpbb_users.user_id = ".$id."	AND grand_user_group.user_id = ".$id."	AND grand_user_group.group_id = 12	;";if( !($result = mysql_query($sql)) )	{		message_die(GENERAL_ERROR, 'Could not obtain rank information', '', __LINE__, __FILE__, $sql);	}$row = mysql_fetch_assoc($result);$sql = "SELECT * FROM phpbb_users	WHERE phpbb_users.user_id IN		(		SELECT grand_user_group.user_id		FROM grand_user_group		WHERE grand_user_group.group_id = 12		)	ORDER BY games_points DESC, games_won DESC, games_lost ASC, username	;";if( !($result = mysql_query($sql)) )	{		message_die(GENERAL_ERROR, 'Could not obtain rank information', '', __LINE__, __FILE__, $sql);	}if (!$username = $row['username']) $username = "No such user!";if (!$points = $row['games_points']) $points = 0;$current = 1;while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){	if ($row["user_id"] === $id)	{		$rank = $current;	}	$current++;}$total = mysql_num_rows($result);if ($rank) $rank = $rank . " of " . $total;mysql_close();//$rank = array_search($username,$all) + 1;$image = imagecreatefrompng('images/redblue.png');$white = imagecolorallocate($image,255,255,255);$black = imagecolorallocate($image,0,0,0);$font = 'images/visitor-tt2-brk.ttf';//imagettftext($image,12,0,200,12,$white,$font,'GT League Points:');imagettftext($image,12,0,320,12,$white,$font,$points);imagettftext($image,12,0,10,12,$white,$font,$username);imagettftext($image,12,0,200,12,$white,$font,$rank);imagepng($image);function print_r_html($data,$return_data=false){   $data = print_r($data,true);   $data = str_replace( " ","&nbsp;", $data);   $data = str_replace( "\r\n","<br>\r\n", $data);   $data = str_replace( "\r","<br>\r", $data);   $data = str_replace( "\n","<br>\n", $data);   if (!$return_data)       echo $data;      else       return $data;}//print_r_html($all);?>