Ulysses Stuff > Ulysses Release Archives

Simple, Configurable, Uban multi-page php viewer

(1/2) > >>

DJWolf:
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: ---<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>
--- End code ---

OH, forgot, make sure you save the page as bans.php or change the line at the bottom of the page to say 
--- Code: ---echo "<a href='YOUR PAGE NAME ?page=".$i."'>".$i."</a> ";
--- End code ---

Megiddo:
Nice and simple, just the way we like things around here. Good job! :)

Aero:
Great work bro!

pikkip:
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=

JamminR:
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.

Navigation

[0] Message Index

[#] Next page

Go to full version