MyBB Community Forums

Full Version: how to add banlist to my forums
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
so, i run a garrys mod server, and i want a banlist on my forums like here: http://victusgaming.com/forum/index.php
(2017-02-20, 10:51 PM)Blade:) Wrote: [ -> ]so, i run a garrys mod server, and i want a banlist on my forums like here: http://victusgaming.com/forum/index.php

Banlist as in when someone gets banned from the server or forums?
If forums then create a new bans.php file in your FTP root directory and just paste this code in..

<?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);


?>
server and forums

where does it go on the forums? I cant find it

bump.
(2017-02-21, 02:12 PM)Blade:) Wrote: [ -> ]server and forums

where does it go on the forums? I cant find it

bump.
Just upload it to the root directory via FTP. My forum is just example.com and not example.com/forum/  though.I would assume this code would work either way, but not sure.
as in like ive uploaded ir but cant fond link to get there on forums
^ You are using Icyboards services.

This issue was resolved on Icyboards Support Forums. You cannot access root files to upload additional pages OR plugins. You can manually make a page and type in via the Page Manager but PHP is not allowed at Icyboards.


Unless you have already moved to self hosting, this will not solve your issue and your issue cannot be solved.

I would be happy to make a simple table for you to use via the Page Manager for Icyboards and add users in manually, you will just need to let me know over at Icyboards. Smile
I switched to x10 hosting
Are you using this in Page Manager or did you create a whole new file in your FTP?
whole new one
what did you name the file? and what is the link to your forum?
Pages: 1 2 3