SHARE
TWEET

Untitled

a guest Jul 20th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. // Convert a SteamID to SteamID64 format.
  4. function toCommunityID($id) {
  5.     if (preg_match('/^STEAM_/', $id)) {
  6.         $parts = explode(':', $id);
  7.         return bcadd(bcadd(bcmul($parts[2], '2'), '76561197960265728'), $parts[1]);
  8.     } else if (is_numeric($id) && strlen($id) < 16) {
  9.         return bcadd($id, '76561197960265728');
  10.     } else {
  11.         return $id; // We have no idea what this is, so just return it.
  12.     }
  13. }
  14.  
  15. // Show the active guard bans in the database.
  16. function showActiveBans() {
  17.     include 'includes/config.php';
  18.  
  19.     $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  20.  
  21.     if ($conn->connect_error) {
  22.         die("Connection failed: " . $conn->connect_error);
  23.     }
  24.     $query = "SELECT * FROM `guardbans` WHERE `status` = '1';";
  25.     $results = $conn->query($query);
  26.  
  27.     if ($results->num_rows > 0) {
  28.         while ($row = $results->fetch_assoc()) {
  29.             $name               = $row['name'];
  30.             $steamid            = $row['steamid'];
  31.             $time               = $row['time'];
  32.             $timeleft           = $row['timeleft'];
  33.             $ban_admin_name     = $row['ban_admin_name'];
  34.             $ban_admin_steamid  = $row['ban_admin_steamid'];
  35.             $ban_reason         = $row['ban_reason'];
  36.             $ban_date           = $row['ban_date'];
  37.             if ($ban_date === '0000-00-00 00:00:00') {
  38.                 $ban_date = 'Unavailable';
  39.             } else {
  40.                 $ban_date = date('l, F jS (g:i A)', strtotime($ban_date));
  41.             }
  42.  
  43.             $name = str_replace("[F2P]", "", $name);
  44.             $steamid64 = toCommunityID($steamid);
  45.  
  46.             echo "<tr>";
  47.             echo "<td><a href='http://steamcommunity.com/profiles/" . $steamid64 . "' target='_blank'> " . $name . "</a></td>";
  48.             echo "<td>" . $time . " minutes</td>";
  49.             echo "<td>" . $timeleft . " minutes</td>";
  50.             echo "<td>";
  51.             if ($ban_admin_steamid !== 'CONSOLE') {
  52.                 echo "<a href='http://steamcommunity.com/profiles/" . toCommunityID($ban_admin_steamid) . "' target='_blank'>" . $ban_admin_name . "</a>";
  53.             } else {
  54.                 echo 'CONSOLE';
  55.             }
  56.             echo "</td>";
  57.             echo "<td>" . $ban_reason . "</td>";
  58.             echo "<td>" . $ban_date . "</td>";
  59.             echo "</tr>";
  60.         }
  61.     } else {
  62.         echo "No results found.";
  63.     }
  64.  
  65.     $conn->close();
  66. }
  67.  
  68. // Show the expired guard bans in the database.
  69. function showExpiredBans() {
  70.     include 'includes/config.php';
  71.  
  72.     $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  73.  
  74.     if ($conn->connect_error) {
  75.         die("Connection failed: " . $conn->connect_error);
  76.     }
  77.     $query = "SELECT * FROM `guardbans` WHERE `status` = '0';";
  78.     $results = $conn->query($query);
  79.  
  80.     if ($results->num_rows > 0) {
  81.         while ($row = $results->fetch_assoc()) {
  82.             $name               = $row['name'];
  83.             $steamid            = $row['steamid'];
  84.             $time               = $row['time'];
  85.             $ban_admin_name     = $row['ban_admin_name'];
  86.             $ban_admin_steamid  = $row['ban_admin_steamid'];
  87.             $ban_reason         = $row['ban_reason'];
  88.             $ban_date           = $row['ban_date'];
  89.             $expire_date        = $row['expire_date'];
  90.             if ($ban_date === '0000-00-00 00:00:00') {
  91.                 $ban_date = 'Unavailable';
  92.             } else {
  93.                 $ban_date = date('l, F jS (g:i A)', strtotime($ban_date));
  94.             }
  95.  
  96.             if ($expire_date === '0000-00-00 00:00:00') {
  97.                 $expire_date = 'Unavailable';
  98.             } else {
  99.                 $expire_date = date('l, F jS (g:i A)', strtotime($expire_date));
  100.             }
  101.  
  102.             $name = str_replace("[F2P]", "", $name);
  103.  
  104.             echo "<tr>";
  105.             echo "<td><a href='http://steamcommunity.com/profiles/" . toCommunityID($steamid) . "' target='_blank'>" . $name . "</a></td>";
  106.             echo "<td>" . $time . " minutes</td>";
  107.             echo "<td>";
  108.             if ($ban_admin_steamid !== 'CONSOLE') {
  109.                 echo "<a href='http://steamcommunity.com/profiles/" . toCommunityID($ban_admin_steamid) . "' target='_blank'>" . $ban_admin_name . "</a>";
  110.             } else {
  111.                 echo 'CONSOLE';
  112.             }
  113.             echo "</td>";
  114.             echo "<td>" . $ban_reason . "</td>";
  115.             echo "<td>" . $ban_date . "</td>";
  116.             echo "<td>" . $expire_date . "</td>";
  117.             echo "</tr>";
  118.         }
  119.     } else {
  120.         echo "No results found.";
  121.     }
  122.  
  123.     $conn->close();
  124. }
  125.  
  126. // Show the unbanned guard bans in the database.
  127. function showUnbannedBans() {
  128.     include 'includes/config.php';
  129.  
  130.     $conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  131.  
  132.     if ($conn->connect_error) {
  133.         die("Connection failed: " . $conn->connect_error);
  134.     }
  135.     $query = "SELECT * FROM `guardbans` WHERE `status` = '-1';";
  136.     $results = $conn->query($query);
  137.  
  138.     if ($results->num_rows > 0) {
  139.         while ($row = $results->fetch_assoc()) {
  140.             $name                = $row['name'];
  141.             $steamid             = $row['steamid'];
  142.             $time                = $row['time'];
  143.             $ban_admin_name      = $row['ban_admin_name'];
  144.             $ban_admin_steamid   = $row['ban_admin_steamid'];
  145.             $ban_reason          = $row['ban_reason'];
  146.             $ban_date            = $row['ban_date'];
  147.             $unban_admin_name    = $row['unban_admin_name'];
  148.             $unban_admin_steamid = $row['unban_admin_steamid'];
  149.             $unban_reason        = $row['unban_reason'];
  150.             $unban_date          = $row['unban_date'];
  151.             if ($ban_date === '0000-00-00 00:00:00') {
  152.                 $ban_date = 'Unavailable';
  153.             } else {
  154.                 $ban_date = date('l, F jS (g:i A)', strtotime($ban_date));
  155.             }
  156.  
  157.             if ($unban_date === '0000-00-00 00:00:00') {
  158.                 $unban_date = 'Unavailable';
  159.             } else {
  160.                 $unban_date = date('l, F jS (g:i A)', strtotime($unban_date));
  161.             }
  162.  
  163.             $name = str_replace("[F2P]", "", $name);
  164.  
  165.             echo "<tr>";
  166.             echo "<td><a href='http://steamcommunity.com/profiles/" . toCommunityID($steamid) . "' target='_blank'>" . $name . "</a></td>";
  167.             echo "<td>" . $time . " minutes</td>";
  168.             echo "<td>";
  169.             if ($ban_admin_steamid !== 'CONSOLE') {
  170.                 echo "<a href='http://steamcommunity.com/profiles/" . toCommunityID($ban_admin_steamid) . "' target='_blank'>" . $ban_admin_name . "</a>";
  171.             } else {
  172.                 echo 'CONSOLE';
  173.             }
  174.             echo "</td>";
  175.             echo "<td>" . $ban_reason . "</td>";
  176.             echo "<td>" . $ban_date . "</td>";
  177.             echo "<td>";
  178.             if ($unban_admin_steamid !== 'CONSOLE') {
  179.                 echo "<a href='http://steamcommunity.com/profiles/" . toCommunityID($unban_admin_steamid) . "' target='_blank'>" . $unban_admin_name . "</a>";
  180.             } else {
  181.                 echo 'CONSOLE';
  182.             }
  183.             echo "</td>";
  184.             echo "<td>" . $unban_reason . "</td>";
  185.             echo "<td>" . $unban_date . "</td>";
  186.             echo "</tr>";
  187.         }
  188.     } else {
  189.         echo "No results found.";
  190.     }
  191.  
  192.     $conn->close();
  193. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top