MyBB Community Forums

Full Version: Banlist producing error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This code gives an error like this: 
https://imgur.com/a/ZtS7tDR
<?php

	define("IN_MYBB", 1);
	require_once "./global.php";

	if($mybb->user['uid'] == 0)
	{
		error_no_permission();
	}
	
	add_breadcrumb("Custom Pages", "custom.php");
	
	$title = "Banned Member List";
	add_breadcrumb($title);

	if(!$mybb->user['uid']){
		error_no_permission();
	}
	
	//pagination start
	$query = $db->simple_select("banned", "COUNT(uid) AS results"); // change pid to your primary key field
	$totalcount = $db->fetch_field($query, "results"); 
	$perpage = 10;
	$pages = $totalcount / $perpage; 
	$pages = ceil($pages);
	$currentpage = (int) $mybb->input['page'];

	/* some PHP to generate your page */
	$url = $mybb->settings['bburl'] . "/bans.php";
	
	if ($currentpage > 0) {
		$multipage = multipage($totalcount, $perpage, $currentpage, $url);
		$offset = ($currentpage - 1) * $perpage; // forgive the lack of indentation, mybb keeps stripping out the tab characters
	}
	else {
		$multipage = multipage($totalcount, $perpage, '1', $url);
		$offset = 0;
	}
	//pagination end

	$message .= '
	<table border="0" cellspacing="'.$theme['borderwidth'].'" cellpadding="'.$theme['tablespace'].'" class="tborder">
	<tr>
		<td class="thead" colspan="5"><span class="smalltext"><strong>'.$title.'</strong></span></td>
	</tr>
	<tr>
		<td class="tcat" width="15%"><span class="smalltext"><strong>Username</strong></span></td>
		<td class="tcat" width="40%"><span class="smalltext"><strong>Reason</strong></span></td>
		<td class="tcat" width="15%"><span class="smalltext"><strong>Banned On</strong></span></td>
		<td class="tcat" width="15%"><span class="smalltext"><strong>Expires</strong></span></td>
		<td class="tcat" width="15%"><span class="smalltext"><strong>Issued By</strong></span></td>
	</tr>';


	$bannedlist = $db->query("SELECT * FROM `".TABLE_PREFIX."banned` ORDER BY `dateline` DESC LIMIT ".$offset.", ".$perpage);
	$altbg = "trow1";
	while($ban = $db->fetch_array($bannedlist)){

		//$user = get_user($ban['uid']);
		//$banby = get_user($ban['admin']);
		
		
		
		$user = get_user($ban['uid']);
		
			//Username to UID
			$userto = $user[username];
			$queryto = $db->simple_select("users","*","username='$userto'");
			$uidto = $db->fetch_field($queryto, "uid"); 
			//UID to USERNAME
			$userto = get_user($uidto);
			//Formats USERNAME
			$formattednameto = format_name($userto['username'],$userto['usergroup'],$userto['displaygroup']);
		
		$banby = get_user($ban['admin']);
		
			//Username to UID
			$user_issurer = $banby[username];
			$query_issurer = $db->simple_select("users","*","username='$user_issurer'");
			$uid_issurer = $db->fetch_field($query_issurer, "uid"); 
			//UID to USERNAME
			$user_issurer = get_user($uid_issurer);
			//Formats USERNAME
			$formattedname_issurer = format_name($user_issurer['username'],$user_issurer['usergroup'],$user_issurer['displaygroup']);
		
		
		

		if ($ban['lifted'] == "0"){
			$unban = "Never";
		}else{
			$unban = my_date($mybb->settings['dateformat'],$ban['lifted']);
		}
		$altbg = alt_trow();
		$message .= '<tr>
		<td class="'.$altbg.'"><a href="member.php?action=profile&amp;uid='. $ban['uid']. '">' . $formattednameto . '</a></td>
		<td class="'.$altbg.'">'. $ban['reason']. '</td>
		<td class="'.$altbg.'">'. my_date($mybb->settings['dateformat'],$ban['dateline']) .'</td>
		<td class="'.$altbg.'">'. $unban .'</td>
		<td class="'.$altbg.'"><a href="member.php?action=profile&amp;uid='. $ban['admin']. '">' . $formattedname_issurer . '</a></td>
		</tr>';
	}

	$message .= "</table>";
	//error($message,$title);
	
	$page = "<html><head><title>{$title}</title>{$headerinclude}</head>
	<body>
		{$header}
		<br />
		{$multipage}
		{$message}
		{$multipage}
		{$footer}
	</body>
	</html>";

	output_page($page);


?>
error image is not visible for me ! can you post the error message ..
(2020-03-29, 05:06 AM).m. Wrote: [ -> ]error image is not visible for me ! can you post the error message ..
https://imgur.com/a/ZtS7tDR
its now working

(2020-03-29, 05:06 AM).m. Wrote: [ -> ]error image is not visible for me ! can you post the error message ..
you can see the errornow
find 2 occurrences of [username] and change to ['username']
ok thankss