PHP Banlist Page
Personally I use a combination of this page and another called phpMyEdit (bear in mind that you have to configure the main page considering it will allow you to edit your listings.) It can be found here: phpMyEdit
Just Copy the Code in notepad, edit the mysql login info (No it will not display your login info from the web, unless you don't have php enabled), and save as banlist.php or whatever you like and upload to you apache/mysql/php server.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Ultra Banlist</title> </head> <body> <h1>Ultra Banlist</h1> <?php // change these things $server = "localhost"; $dbuser = "root"; $dbpass = "root"; $dbname = "database"; mysql_connect($server, $dbuser, $dbpass); mysql_select_db($dbname); $result = mysql_query("SELECT * FROM banlist ORDER BY id DESC"); //This will display the most recent by id edit this query how you see fit. Limit, Order, ect. echo "<table width=100% border=1 cellpadding=3 cellspacing=0>"; echo "<tr style=\"font-weight:bold\"> <td>Type</td> <td>Name</td> <td>Reason</td> <td>Admin/Mod</td> <td>Time</td> <td>TimeTempBan</td> <td>id</td> </tr>"; while($row = mysql_fetch_assoc($result)){ if($col == "#eeeeee"){ $col = "#ffffff"; }else{ $col = "#eeeeee"; } echo "<tr bgcolor=$col>"; if($row['type'] == "5"){ echo "<td>Unban</td>"; }else{ if($row['type'] == "3"){ echo "<td>Kick</td>"; }else{ if($row['type'] == "2"){ echo "<td>Warn</td>"; }else{ if($row['type'] == "0"){ echo "<td>Banned</td>"; }else{ if($row['type'] == "1"){ echo "<td>IPBanned</td>"; }else{ if($row['type'] == "4"){ echo "<td>Fine</td>"; }else{ if($row['type'] == "6"){ echo "<td>Jailed</td>"; }else{ if($row['type'] == "9"){ echo "<td>Perma</td>"; }else{ echo "<td>Unknown</td>"; //Holy Epic If Statement Batman! } } } } } } } } echo "<td>".$row['name']."</td>"; echo "<td>".$row['reason']."</td>"; echo "<td>".$row['admin']."</td>"; //Convert Epoch Time to Standard format $datetime = date("F j, Y, g:i a", $row['time']); echo "<td>$datetime</td>"; $dateconvert = date("F j, Y, g:i a", $row['temptime']); if($row['temptime'] == "0"){ echo "<td>None</td>"; }else{ echo "<td>$dateconvert</td>"; } echo "<td>".$row['id']."</td>"; echo "</tr>"; } echo"</table>"; ?> </div> Ban database provided by UltraBans. </body></html>
You should update this file. MySQL_* queries are completely unsupported and are VERY vulnerable to attacks.
You should use PDO.
Is that possible that banlist will show only bans or for example only kicks?
@Iluscor
Just modify the query:
Replace three with the type you want - take them from above
How would I need to modify the query if I wanted it to show only the 50 most recent entries?
@CrowMCLP
Never mind. got it.
$result = mysql_query("SELECT * FROM banlist ORDER BY id DESC LIMIT 50");
I have it all set up yet it tells me I have "No database selected" I changed the tables in the ultrabans config, do I need to change them in the php config and if so how do I do this?
CCCCOMBO comment!
P.S. This banlist isn't coded by me, so all feel free to commit at our github page for a new one :P Also i can do new one for you, if you want it :)
@mad_grunt45
You need to change connection data in that code.
@mad_grunt45
Change query to "SELECT * FROM `banlist` WHERE `type` = '0' ORDER BY `id` DESC" for only bans. And change 0 to 3 for only kicks :)
@mad_grunt45
You can do it, if wordpress support PHP code insert.
@mad_grunt45
Also feel free to commit. Also, look old comments. :)
@mad_grunt45
Do your services support PHP code?
@mad_grunt45
Please make some commit at our github page.
@mad_grunt45
Change query to "SELECT * FROM `banlist` WHERE NOT `type` = '2' ORDER BY `id` DESC"
@mad_grunt45
Did you change anything except connection properties?
@mad_grunt45
You just need permissions to connect db externally.
@mad_grunt45
Look line with '$dateconvert = date("F j, Y, g:i a", $row['temptime']);' and google for some 'php data formatting'
@mad_grunt45
If your 'blogger' support PHP — yes, you can.
@mad_grunt45
No, you're not right. DB can be in Africa, and banlist can be in Ireland :) You just need permissions to connect from external hosts ofc.
@mad_grunt45
you're right, php mysql built-in functions is deprecated.
lawl, so code some with mysqli :)
@mad_grunt45
Feel free to commit at our github page. Make some web-dir :)
@mad_grunt45
Seems like you have no connection established.
@mad_grunt45
Also feel free to commit :)
Wow thanks :) I have upgraded this script so it shows only ACTIVE bans (if ban is unbanned, than it wont show older bans for that players) etc... :)
Hey guys i dont know about you but yeah i have well over 20K Infractions and thought i would give this out to everyone, throw this together(only took 5min) a few months back here you all go, have fun -waves hi to crowMCLP down there-
Ubans always took 60sec or longer to load, but now with this basic script im down to 12K Infractions and only takes 15 sec to load, im very happy with it.
I have this,
can someone tell me how ro fix it please?
Notice: Undefined variable: col in C:\xampp\htdocs\Ultrabans\Index.php on line 37
Thanks