MyBB Community Forums

Full Version: Banlist problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Error that I get when I try go to bans.php:

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/luccqqo/public_html/bans.php(7) : eval()'d code on line 4

Here's what's inside my bans.php:

<?php 

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

add_breadcrumb("Ban List", "bans.php"); 

eval("\$html = \"".$templates->get("banlistphp")."\";"); 

output_page($html);

?>

And this is what's inside my banlistphp template:

<html>
<head>
<title>'.$pages['name'].'</title>
{$headerinclude}
</head>
<body>
{$header}
	<table border="0" cellspacing="1" cellpadding="3" class="tborder">
		<thead>
			<tr>
				<td class="thead" colspan="5">
				<strong><center>'.$pages['name'].'</center></strong>
				</td>
			</tr>
		</thead>
<tbody>';

$template .= '
<tr align="center">
	<td class="tcat"><span class="smalltext"><strong>Banned Person</strong></span></td>
	<td class="tcat"><span class="smalltext"><strong>Banned Reason</strong></span></td>
	<td class="tcat"><span class="smalltext"><strong>Who Banned ?</strong></span></td>
	<td class="tcat"><span class="smalltext"><strong>On Date</strong></span></td>
	<td class="tcat"><span class="smalltext"><strong>Lift Date</strong></span></td>
</tr>';
$query = $db->query("SELECT * FROM `".TABLE_PREFIX."banned` ORDER BY `dateline` DESC");
while ($ban = $db->fetch_array($query))
{
	$uid = intval($ban['uid']);
$user = get_user($uid);
$ban_person = build_profile_link($user['username'],$ban['uid']);
if ($ban['reason'] == "")
{
$ban_reason = "N/A";
}
else
{
$ban_reason = htmlspecialchars_uni($ban['reason']);
}
	$banu = get_user($ban['admin']);
	$username = format_name($banu['username'], $banu['usergroup'], $banu['displaygroup']);
	$who_ban = build_profile_link($username, $banu['uid']);
	$on_date = my_date($mybb->settings['dateformat'],$ban['dateline']);
	if ($ban['lifted'] == 'perm' || $ban['lifted'] == '' || $ban['bantime'] == 'perm' || $ban['bantime'] == '---')
	{
		$lift_date = "<div class='smalltext' align='center' style='font-color: red'>Permanent</div>";
	}
	else
	{
		$lift_date = my_date($mybb->settings['dateformat'],$ban['lifted']);
	}
$template .= '
<tr align="center">
	<td class="trow1">'.$ban_person.'</td>
	<td class="trow2">'.$ban_reason.'</td>
	<td class="trow1">'.$who_ban.'</td>
	<td class="trow2">'.$on_date.'</td>
	<td class="trow1">'.$lift_date.'</td>
</tr>';

}

	// Figure out if we need to display multiple pages.
	$perpage = $mybb->settings['threadsperpage'];
	if($mybb->input['page'] != "last")
	{
		$page = intval($mybb->input['page']);
	}

	$query = $db->simple_select("banned", "COUNT(uid) AS count");
	$banned_count = $db->fetch_field($query, "count");

	$postcount = intval($banned_count);
	$pages = $postcount / $perpage;
	$pages = ceil($pages);

	if($mybb->input['page'] == "last")
	{
		$page = $pages;
	}

	if($page > $pages || $page <= 0)
	{
		$page = 1;
	}

	if($page)
	{
		$start = ($page-1) * $perpage;
	}
	else
	{
		$start = 0;
		$page = 1;
	}
	$upper = $start+$perpage;

	$multipage = multipage($postcount, $perpage, $page, "misc.php?page=banned");

$template .= '
	</tbody>
</table><div class="float_left">{$multipage}</div>
	<br/>
{$footer}
</body>
</html>
Are you using php in templates? Otherwise that php won't work in mybb templates. Anyway, it's not a neat practice to use that in templates (I mean it's a rough code) and that is better suited as php file.
I have php in template plugin, yes but when I tried to use it on php file it shows everything but it wont display any names or stuff like that. It's like the site is working but not the actual thing it should do; display banned members.
Just use what you're using now in the php file itself and it should work. Note that you'll need to strip certain variables like {$headerinclude} to $headerinclude. Anyway, you probably won't need to include $headerinclude.
(2012-12-01, 05:19 PM)crazy4cs Wrote: [ -> ]Just use what you're using now in the php file itself and it should work. Note that you'll need to strip certain variables like {$headerinclude} to $headerinclude. Anyway, you probably won't need to include $headerinclude.

When I go to bans.php there's blank page with this text in it:


$header '; $template .= ' '; $query = $db->query("SELECT * FROM `".TABLE_PREFIX."banned` ORDER BY `dateline` DESC"); while ($ban = $db->fetch_array($query)) { $uid = intval($ban['uid']); $user = get_user($uid); $ban_person = build_profile_link($user['username'],$ban['uid']); if ($ban['reason'] == "") { $ban_reason = "N/A"; } else { $ban_reason = htmlspecialchars_uni($ban['reason']); } $banu = get_user($ban['admin']); $username = format_name($banu['username'], $banu['usergroup'], $banu['displaygroup']); $who_ban = build_profile_link($username, $banu['uid']); $on_date = my_date($mybb->settings['dateformat'],$ban['dateline']); if ($ban['lifted'] == 'perm' || $ban['lifted'] == '' || $ban['bantime'] == 'perm' || $ban['bantime'] == '---') { $lift_date = "
Permanent
"; } else { $lift_date = my_date($mybb->settings['dateformat'],$ban['lifted']); } $template .= ' '; } // Figure out if we need to display multiple pages. $perpage = $mybb->settings['threadsperpage']; if($mybb->input['page'] != "last") { $page = intval($mybb->input['page']); } $query = $db->simple_select("banned", "COUNT(uid) AS count"); $banned_count = $db->fetch_field($query, "count"); $postcount = intval($banned_count); $pages = $postcount / $perpage; $pages = ceil($pages); if($mybb->input['page'] == "last") { $page = $pages; } if($page > $pages || $page <= 0) { $page = 1; } if($page) { $start = ($page-1) * $perpage; } else { $start = 0; $page = 1; } $upper = $start+$perpage; $multipage = multipage($postcount, $perpage, $page, "misc.php?page=banned"); $template .= '
'.$pages['name'].'
Banned Person 	Banned Reason 	Who Banned ? 	On Date 	Lift Date
'.$ban_person.' 	'.$ban_reason.' 	'.$who_ban.' 	'.$on_date.' 	'.$lift_date.'
$multipage

$footer 

And this is what I have in my bans.php :

<html>
<head>
<title>'.$pages['name'].'</title>
</head>
<body>
$header
	<table border="0" cellspacing="1" cellpadding="3" class="tborder">
		<thead>
			<tr>
				<td class="thead" colspan="5">
				<strong><center>'.$pages['name'].'</center></strong>
				</td>
			</tr>
		</thead>
<tbody>';

$template .= '
<tr align="center">
	<td class="tcat"><span class="smalltext"><strong>Banned Person</strong></span></td>
	<td class="tcat"><span class="smalltext"><strong>Banned Reason</strong></span></td>
	<td class="tcat"><span class="smalltext"><strong>Who Banned ?</strong></span></td>
	<td class="tcat"><span class="smalltext"><strong>On Date</strong></span></td>
	<td class="tcat"><span class="smalltext"><strong>Lift Date</strong></span></td>
</tr>';
$query = $db->query("SELECT * FROM `".TABLE_PREFIX."banned` ORDER BY `dateline` DESC");
while ($ban = $db->fetch_array($query))
{
	$uid = intval($ban['uid']);
$user = get_user($uid);
$ban_person = build_profile_link($user['username'],$ban['uid']);
if ($ban['reason'] == "")
{
$ban_reason = "N/A";
}
else
{
$ban_reason = htmlspecialchars_uni($ban['reason']);
}
	$banu = get_user($ban['admin']);
	$username = format_name($banu['username'], $banu['usergroup'], $banu['displaygroup']);
	$who_ban = build_profile_link($username, $banu['uid']);
	$on_date = my_date($mybb->settings['dateformat'],$ban['dateline']);
	if ($ban['lifted'] == 'perm' || $ban['lifted'] == '' || $ban['bantime'] == 'perm' || $ban['bantime'] == '---')
	{
		$lift_date = "<div class='smalltext' align='center' style='font-color: red'>Permanent</div>";
	}
	else
	{
		$lift_date = my_date($mybb->settings['dateformat'],$ban['lifted']);
	}
$template .= '
<tr align="center">
	<td class="trow1">'.$ban_person.'</td>
	<td class="trow2">'.$ban_reason.'</td>
	<td class="trow1">'.$who_ban.'</td>
	<td class="trow2">'.$on_date.'</td>
	<td class="trow1">'.$lift_date.'</td>
</tr>';

}

	// Figure out if we need to display multiple pages.
	$perpage = $mybb->settings['threadsperpage'];
	if($mybb->input['page'] != "last")
	{
		$page = intval($mybb->input['page']);
	}

	$query = $db->simple_select("banned", "COUNT(uid) AS count");
	$banned_count = $db->fetch_field($query, "count");

	$postcount = intval($banned_count);
	$pages = $postcount / $perpage;
	$pages = ceil($pages);

	if($mybb->input['page'] == "last")
	{
		$page = $pages;
	}

	if($page > $pages || $page <= 0)
	{
		$page = 1;
	}

	if($page)
	{
		$start = ($page-1) * $perpage;
	}
	else
	{
		$start = 0;
		$page = 1;
	}
	$upper = $start+$perpage;

	$multipage = multipage($postcount, $perpage, $page, "misc.php?page=banned");

$template .= '
	</tbody>
</table><div class="float_left">$multipage</div>
	<br/>
$footer
</body>
</html>
It would be much easier if you posted the link to that plugin.
There is no plugin. Someone moved this in here.
(2012-12-01, 11:22 PM)BccMac Wrote: [ -> ]There is no plugin. Someone moved this in here.

I am confused. It should be some kind of plugin that you are using to display the banned users.
There is no core file called bans.php. So it is a modification of some sort. It looks a bit like code for the pagemanager plugin that has been hacked about.
Pages: 1 2