Ulysses

Ulysses Stuff => Releases => Ulysses Release Archives => Topic started by: DJWolf on August 11, 2011, 09:49:15 AM

Title: Simple, Configurable, Uban multi-page php viewer
Post by: DJWolf on August 11, 2011, 09:49:15 AM
I got tired of looking for a php page that would let me list our server bans, so i made this with a bit of help from a guy named Corporate Bastard
It "makes" multiple pages so you wont have a big long list on 1 page.
You can set how wide the table is, how many bans to show per page, and if you want to, you can change the the names of the Columns.
When the ban is a perma ban, the unban time says never
Be sure to set the db address, user and pass at the top, as well as the database and table
If you must you can remove the part at the bottom that says "By DJ Wolf(technowolf248)"

Code: [Select]
<html>
<body>
<?php
//CONFIG
$db_address "127.0.0.1";
$db_user "root";
$db_pass "";
$database "test";
$table "gbans";
$bpp "50"//how many bans per page
$width "925"//how wide the table is
?>


<?php
$con 
mysql_connect($db_address,$db_user,$db_pass);
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db("$database"$con);
if (isset(
$_GET["page"])) { $page  $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * $bpp;
$result mysql_query("SELECT * FROM $table ORDER BY id DESC LIMIT $start_from$bpp");

//EDIT THE NAMES, DO NOT CHANGE THE ORDER
echo "<table border='1'>
<table width='
$width'>
<tr>
<th>Name</th>
<th>Steam ID</th>
<th>Ban Time</th>
<th>Unban Time</th>
<th>Reason</th>
<th>Admin</th>

</tr>"
;

while(
$row mysql_fetch_array($result)){
if( 
$row['unban_time'] == "0000-00-00 00:00:00" ){$ubtime =  "Never";
}else{
$ubtime =  $row['unban_time'];
}

  echo 
"<tr>";
  echo 
"<td>" .htmlentities($row['name']) . "</td>";
  echo 
"<td>" $row['steamid']."</td>";
  echo 
"<td>" $row['time']."</td>";
  echo 
"<td>" $ubtime."</td>";
  echo 
"<td>" .htmlentities($row['comment']) . "</td>";
  echo 
"<td>" .htmlentities($row['adminname']) . "</td>";
  echo 
"</tr>";
  }
echo 
"</table>";

$result = ("SELECT COUNT(Name) FROM $table");
$rs_result mysql_query($result,$con);
$row mysql_fetch_row($rs_result);
$total_records $row[0];
$total_pages ceil($total_records $bpp);

for (
$i=1$i<=$total_pages$i++) {
            echo 
"<a href='bans?page=".$i."'>".$i."</a> ";
};

mysql_close($con);
?>

</body>
<footer>
By DJ Wolf(technowolf248)
</footer>
</html>

OH, forgot, make sure you save the page as bans.php or change the line at the bottom of the page to say 
Code: [Select]
echo "<a href='YOUR PAGE NAME ?page=".$i."'>".$i."</a> ";
Title: Re: Simple, Configurable, Uban multi-page php viewer
Post by: Megiddo on August 11, 2011, 06:13:50 PM
Nice and simple, just the way we like things around here. Good job! :)
Title: Re: Simple, Configurable, Uban multi-page php viewer
Post by: Aero on August 11, 2011, 07:43:05 PM
Great work bro!
Title: Re: Simple, Configurable, Uban multi-page php viewer
Post by: pikkip on February 24, 2012, 06:50:08 AM
I know this is a old thread, but it really gets me on my nerves,

what kinda scoureban does it request?

i found this http://www.sourcebans.net/ but dono if that can work? please help D=
Title: Re: Simple, Configurable, Uban multi-page php viewer
Post by: JamminR on February 24, 2012, 04:08:44 PM
Nikki, as the subject of the topic says, the code was meant to show UBan bans.
UBan has nothing to do with SourceBans.
The only similarity is that it would allow one SQL ban library for multiple ULib servers.
Search the Releases forum area to learn about UBan.
Title: Re: Simple, Configurable, Uban multi-page php viewer
Post by: pikkip on February 25, 2012, 08:47:31 AM
Nikki, as the subject of the topic says, the code was meant to show UBan bans.
UBan has nothing to do with SourceBans.
The only similarity is that it would allow one SQL ban library for multiple ULib servers.
Search the Releases forum area to learn about UBan.

Thanks, i was just a bit confused cause i never used mysql / database for a global banning system