2017-02-20, 10:51 PM
2017-02-21, 12:46 PM
(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&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&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);
?>
2017-02-21, 02:12 PM
server and forums
where does it go on the forums? I cant find it
bump.
where does it go on the forums? I cant find it
bump.
2017-02-22, 01:29 AM
(2017-02-21, 02:12 PM)Blade:) Wrote: [ -> ]server and forumsJust 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.
where does it go on the forums? I cant find it
bump.
2017-02-22, 06:00 AM
as in like ive uploaded ir but cant fond link to get there on forums
2017-02-22, 02:08 PM
^ 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.
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.
2017-02-22, 02:59 PM
I switched to x10 hosting
2017-02-22, 03:04 PM
Are you using this in Page Manager or did you create a whole new file in your FTP?
2017-02-22, 03:28 PM
whole new one
2017-02-22, 03:34 PM
what did you name the file? and what is the link to your forum?