Cronwerks MCCode/MCCodes Forums

Please login or register.

Login with username, password and session length

News:

Can't find exactly what you've been wanting? Try searching for what you are looking for in the search box to the right. ----------->


Poll

What do you think?

Good
- 5 (62.5%)
Bad
- 3 (37.5%)

Total Members Voted: 8

AuthorTopic: [MCV2]New fedjail.php  (Read 371 times)

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 103
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
[MCV2]New fedjail.php
« on: February 19, 2010, 09:35:10 AM »
Hey Guys.

I've never actually seen someone release a nice Fedjail.php, I've seen some good updates but non worth really looking at for longer than 5seconds lol, Anyway here's my new version,

It is..

    * Secure
    * Clean Code
    * Tested and fully working
    * All in one big page (:
    * Free =]

As I said, I've changed quite a bit, Ranging from the "SELECT * FROM" too the actual display off it =]

Code: [Select]
<?php
include_once (DIRNAME(__FILE__) . '/globals.php');
$_GET['action'] = isset($_GET['action']) && ctype_alpha($_GET['action']) ? trim($_GET['action']) : 'index';
switch(
$_GET['action'])
{
case 
'banned'fedded(); break;
case 
'forum'forum_banned(); break;
case 
'mails'mail_banned(); break;
default: 
index(); break;
}
if (!
in_array($_GET['action'], array('banned','forum','mails','index'))) {
echo 
"<strong>Invalid Action.</strong>";
$h->endpage();
exit;
}
function 
formatter($str) { return is_numeric($str) ? number_format($str) : htmlentities(stripslashes($str)); }
function 
index()
{
print 
"<h3>Jail Management</h3><br />";
global 
$db;
$feddedusers $db->fetch_single($db->query("SELECT COUNT(`userid`) FROM users WHERE (fedjail = 1)"));
$mailbanned $db->fetch_single($db->query("SELECT COUNT(`userid`) FROM users WHERE (mailban > 0)"));
$forumbanned $db->fetch_single($db->query("SELECT COUNT(`userid`) FROM users WHERE (forumban > 0)"));
echo 
"<table class='table' width='50%'>";
echo 
"<tr>";
echo 
"<th><a href='?action=banned'>Federal Jail</a></th>";
echo 
"<td style='text-align:center;'>".$feddedusers."</a></td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<th><a href='?action=mails'>Mail Banned</a></th>";
echo 
"<td style='text-align:center;'>".$mailbanned."</td>";
echo 
"</tr>";
echo 
"<tr>";
echo 
"<th><a href='?action=forum'>Forum Banned</a></th>";
echo 
"<td style='text-align:center;'>".$forumbanned."</td>";
echo 
"</tr>";
echo 
"</table>";
}
function 
fedded()
{
global 
$db,$r,$h;
echo 
'
<h3 style="text-align: left; text-decoration: underline;">Ferderal Jail</h3>
<table border="1" width="100%" class="table" cellspacing="0" cellpadding="2">
    <tr style="text-align:center;">
        <th>Who</th>
        <th>Time Left</th>
        <th>Reason</th>
        <th>Jailer</th>
    </tr>
'
;
$Find $db->query("SELECT f.fed_userid, f.fed_days, f.fed_reason, u.username, " .
"uu.userid AS fed_jailer_id, uu.username AS fed_jailer " .
"FROM fedjail f " .
"LEFT JOIN users u ON f.fed_userid=u.userid " .
"LEFT JOIN users uu ON f.fed_jailedby = uu.userid " .
"WHERE f.fed_days > 0 ORDER BY f.fed_days ASC");
while(
$r $db->fetch_row($Find))
{
    echo 
'
    <tr style="text-align:center;"> 
             <td><a href="viewuser.php?u='
.$r['fed_userid'].'">'.formatter($r['username']).'</a></td>
            <td>'
.formatter($r['fed_days']).' Days</td>
            <td>'
.formatter($r['fed_reason']).'</td>
            <td><a href="viewuser.php?u='
.$r['fed_jailer_id'].'"><b>'.formatter($r['fed_jailer']).'</b></a> ['.$r['fed_jailer_id'].']</td>
        </tr>
    '
;
}
echo 
'</table>';
}
function 
mail_banned()
{
global 
$db,$r,$h;
print 
'<h3 style="text-align: left; text-decoration: underline;">MailBanned Users</h3>
<table border="1" width="100%" class="table" cellspacing="0" cellpadding="2">
    <tr style="text-align:center;">
        <th>Who</th>
        <th>Time Left</th>
        <th>Reason</th>
    </tr>
    '
;
$q=$db->query("SELECT `userid`,`username`,`mailban`,`mb_reason` FROM `users` WHERE `mailban` > 0 ORDER BY `mailban` DESC");
while(
$r=$db->fetch_row($q))
{
print 
"
<tr>
<td><a href='viewuser.php?u="
.$r['userid']."'>".formatter($r['username'])."</a></td>
<td>"
.formatter($r['mailban'])."</td>
<td>"
.formatter($r['mb_reason'])."</td>
</tr>"
;
}
echo 
"</table>";
}
function 
forum_banned()
{
global 
$db,$r,$h;
print 
'<h3 style="text-align: left; text-decoration: underline;">Forumbanned Users</h3>
<table border="1" width="100%" class="table" cellspacing="0" cellpadding="2">
    <tr style="text-align:center;">
        <th>Who</th>
        <th>Time Left</th>
        <th>Reason</th>
    </tr>
    '
;
$q=$db->query("SELECT `userid`,`username`,`forumban`,`fb_reason` FROM users WHERE `forumban` > 0 ORDER BY `forumban` DESC");
while(
$r=$db->fetch_row($q))
{
print 
"<tr>
<td><a href='viewuser.php?u="
.$r['userid']."'>".formatter($r['username'])."</a></td>
<td>"
.formatter($r['forumban'])."</td>
<td>"
.formatter($r['fb_reason'])."</td></tr>";
}
echo 
"</table>";
}
$h->endpage();
?>


There is no need for screen shots, As replacing the file will show you what it can do =]

Please leave bugs/suggestions/comments & Please vote in the Poll I've added =]
« Last Edit: February 20, 2010, 09:00:32 AM by Jordan »
Logged

Pudda2008@hotmail.co.uk - Feel free to add me on MSN

strats

  • Active Member
  • **
  • Reputation Power: 13
  • strats has no influence.
  • Offline Offline
  • Posts: 109
    • View Profile
Re: [MCV2]New fedjail.php
« Reply #1 on: February 19, 2010, 04:46:18 PM »
Really like this Jordan, Nice work.
Logged

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 103
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
Re: [MCV2]New fedjail.php
« Reply #2 on: February 20, 2010, 08:43:35 AM »
Thanks.
Logged

Pudda2008@hotmail.co.uk - Feel free to add me on MSN

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 103
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
Re: [MCV2]New fedjail.php
« Reply #3 on: February 20, 2010, 09:00:50 AM »
Screenshot Added
Logged

Pudda2008@hotmail.co.uk - Feel free to add me on MSN

Danny696

  • Excellent Member
  • ***
  • Reputation Power: 276
  • Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.Danny696 has a powerful will.
  • Offline Offline
  • Posts: 457
    • View Profile
Re: [MCV2]New fedjail.php
« Reply #4 on: February 20, 2010, 02:18:16 PM »
Nice, alot cleaner
Logged
My Game: GraveYard; Madness || Projects; N/A -  Available for work. Please IM/PM me.

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 103
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
Re: [MCV2]New fedjail.php
« Reply #5 on: February 20, 2010, 07:22:55 PM »
Thanks mate
Logged

Pudda2008@hotmail.co.uk - Feel free to add me on MSN

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 103
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
Re: [MCV2]New fedjail.php
« Reply #6 on: February 21, 2010, 05:07:41 PM »
Bumpz (Immortal is too :D)
Logged

Pudda2008@hotmail.co.uk - Feel free to add me on MSN

05timbyd

  • Basic Member
  • *
  • Reputation Power: 3
  • 05timbyd has no influence.
  • Offline Offline
  • Posts: 7
    • View Profile
    • Email
Re: [MCV2]New fedjail.php
« Reply #7 on: March 07, 2010, 04:26:31 PM »
Lol is that when i viewed the source to see if it was compatible with my browser and it fedded me xD
Logged

Jordan

  • Active Member
  • **
  • Reputation Power: 55
  • Jordan has no influence.
  • Offline Offline
  • Posts: 103
  • Website Developer for hire;
    • MSN Messenger - Pudda2008@hotmail.co.uk
    • View Profile
    • WWW
    • Email
Re: [MCV2]New fedjail.php
« Reply #8 on: March 10, 2010, 10:45:42 AM »
No that was the other one I have lol
Logged

Pudda2008@hotmail.co.uk - Feel free to add me on MSN