Sinisterly
#Generous - Ban List Page - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Design (https://sinister.li/Forum-Design)
+--- Forum: Web Design (https://sinister.li/Forum-Web-Design)
+--- Thread: #Generous - Ban List Page (/Thread-Generous-Ban-List-Page)

Pages: 1 2


#Generous - Ban List Page - Jasper - 09-25-2015

Well, I am a generous guy I think. So here you go, a ban list. :yus:

Preview: https://realityforum.net/banlist

[hide]

1. Make a .php file called "banlist.php"
2. Enter all this code to the banlist.php file and save it, then upload it to root.

Code:
<?php define("IN_MYBB", 1); define("THIS_SCRIPT", "banlist.php"); require_once "./global.php"; global $headerinclude, $header, $theme, $footer; if(!$mybb->user['uid']) { error("Sorry, only registered members can view this page. Please login or register to view it."); } if(!$mybb->input['action']) { if(!$mybb->settings['threadsperpage']) { $mybb->settings['threadsperpage'] = 20; } $perpage = $mybb->settings['threadsperpage']; if($mybb->get_input('page') != "last") { $page = $mybb->get_input('page', MyBB::INPUT_INT); } $query = $db->simple_select("banned", "COUNT(uid) AS count"); $banned_count = $db->fetch_field($query, "count"); $postcount = (int)$banned_count; $pages = $postcount / $perpage; $pages = ceil($pages); if($mybb->get_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, "banlist.php"); $query = $db->write_query(" SELECT b.*, a.username AS adminuser, u.username FROM ".TABLE_PREFIX."banned b LEFT JOIN ".TABLE_PREFIX."users u ON (b.uid=u.uid) LEFT JOIN ".TABLE_PREFIX."users a ON (b.admin=a.uid) ORDER BY dateline DESC LIMIT {$start}, {$perpage} "); $bannedusers = ''; while($banned = $db->fetch_array($query)) { $profile_link = build_profile_link($banned['username'], $banned['uid']); $ban_date = my_date('relative', $banned['dateline']); $admin_profile = htmlspecialchars_uni($banned['adminuser']); $admin_uid = get_profile_link($banned['admin']); if($banned['reason']) { $banned['reason'] = htmlspecialchars_uni($banned['reason']); } else { $banned['reason'] = "N/A"; } if($banned['lifted'] == 'perm' || $banned['lifted'] == '' || $banned['bantime'] == 'perm' || $banned['bantime'] == '---') { $timeremaining = "<span style=\"color: red; text-shadow: 1px 1px 1px #000;\">Never</span>"; } else { $banlength = $bantimes[$banned['bantime']]; $remaining = $banned['lifted']-TIME_NOW; $timeremaining = nice_time($remaining, array('short' => 1, 'seconds' => false)).""; if($remaining < 3600) { $timeremaining = "({$timeremaining})"; } else if($remaining < 86400) { $timeremaining = "({$timeremaining})"; } else if($remaining < 604800) { $timeremaining = "({$timeremaining})"; } else { $timeremaining = "({$timeremaining})"; } } eval("\$bannedusers .= \"".$templates->get("banlist_row")."\";"); } } add_breadcrumb("Ban List", "banlist.php"); eval("\$html = \"".$templates->get("banlist")."\";"); output_page($html); ?>
3. Go to,

Home » Template Sets » Global Templates

Create a new template called "banlist" (no quotes) with this content

Code:
<html> <head> <title>{$mybb->settings['bbname']} - Ban List</title> {$headerinclude} </head> <body> {$header} <table border="0" cellspacing="{$theme['borderwidth']}" cellpadding="{$theme['tablespace']}" width="100%" class="tborder"> {$multipage} <tr> <td colspan="5" class="thead"><strong>List of Banned Users</strong></td> </tr> <tbody> <tr> <td class="tcat">Username</td> <td class="tcat">Reason</td> <td class="tcat">Banned By</td> <td class="tcat" align="left">Ban Date</td> <td class="tcat" align="right">Unban Date</td> </tr> {$bannedusers} </tbody> </table> </td> </tr> </table> <br class="clear" /> {$footer} </body> </html>

Now when you're done with that, create another template with the name "banlist_row" (without quotes) in Global Templates, with the content

Code:
<tr> <td class="trow1">{$profile_link}</td> <td class="trow1">{$banned['reason']}</td> <td class="trow1"><a href="{$admin_uid}">{$admin_profile}</a></td> <td class="trow1" align="left">{$ban_date}</td> <td class="trow1" align="right">{$timeremaining}</td> </tr>
[/hide]

If you need help, hit me up. Confusedmile:


RE: #Generous - Ban List Page - Ukrainboy99 - 09-25-2015

Can't unlock because i have -credits. Sad(


RE: #Generous - Ban List Page - Man - 09-25-2015

(09-25-2015, 12:32 AM)Ukrainboy99 Wrote: Can't unlock because i have -credits. Sad(

That's what you get for abusing the system.


RE: #Generous - Ban List Page - Shiraishi - 09-25-2015

@Maeko Luv u bby <3


RE: #Generous - Ban List Page - Man - 09-25-2015

Generous indeed. Nice one, Maeko.


RE: #Generous - Ban List Page - ɘxɘ - 09-25-2015

@Maeko isn't generous, he does this for personal gain. He is a cunt and should be shunned.


RE: #Generous - Ban List Page - Jasper - 09-26-2015

(09-25-2015, 11:21 PM)respect Wrote: @Maeko isn't generous, he does this for personal gain. He is a cunt and should be shunned.

You're right.


RE: #Generous - Ban List Page - ɘxɘ - 09-26-2015

(09-26-2015, 08:01 AM)Maeko Wrote:
(09-25-2015, 11:21 PM)respect Wrote: @Maeko isn't generous, he does this for personal gain. He is a cunt and should be shunned.

You're right.

When am I not?


RE: #Generous - Ban List Page - Dutchy - 09-26-2015

That is very generous. Indeed.


RE: #Generous - Ban List Page - Man - 09-26-2015

Just implemented this onto my forum and works flawlessly.