PageRenderTime 66ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/echelon/adminbans.php

https://github.com/xlr8or/echelon
PHP | 149 lines | 140 code | 8 blank | 1 comment | 24 complexity | 14fd3c898f32c276310a365456ec7de7 MD5 | raw file
  1. <?php
  2. include "ctracker.php";
  3. error_reporting( E_ERROR ^ E_WARNING );
  4. // Next line sets the echelon userlevel for this page. 1=superadmins - 2=admins - 3=moderators
  5. $requiredlevel = 3;
  6. require_once('Connections/b3connect.php');
  7. require_once('login/inc_authorize.php');
  8. $currentPage = $_SERVER["PHP_SELF"];
  9. $maxRows_rs_activebans = 25;
  10. $pageNum_rs_activebans = 0;
  11. if (isset($_GET['pageNum_rs_activebans'])) {
  12. $pageNum_rs_activebans = $_GET['pageNum_rs_activebans'];
  13. }
  14. $startRow_rs_activebans = $pageNum_rs_activebans * $maxRows_rs_activebans;
  15. $xlorderby_rs_activebans = "id";
  16. if (isset($_GET['orderby'])) {
  17. $xlorderby_rs_activebans = (get_magic_quotes_gpc()) ? $_GET['orderby'] : addslashes($_GET['orderby']);
  18. }
  19. $xlorder_rs_activebans = "DESC";
  20. if (isset($_GET['order'])) {
  21. $xlorder_rs_activebans = (get_magic_quotes_gpc()) ? $_GET['order'] : addslashes($_GET['order']);
  22. }
  23. mysql_select_db($database_b3connect, $b3connect);
  24. $query_rs_activebans = sprintf("SELECT penalties.id, penalties.type, penalties.time_add, penalties.time_expire, penalties.reason, penalties.inactive, penalties.duration, target.id as target_id, target.name as target_name, admin.id as admi_id, admin.name as admi_name FROM penalties, clients as admin, clients as target WHERE admin_id != '0' AND (penalties.type = 'Ban' OR penalties.type = 'TempBan') AND inactive = 0 AND penalties.time_expire <> 0 AND penalties.client_id = target.id AND penalties.admin_id = admin.id ORDER BY %s %s", $xlorderby_rs_activebans,$xlorder_rs_activebans);
  25. $query_limit_rs_activebans = sprintf("%s LIMIT %d, %d", $query_rs_activebans, $startRow_rs_activebans, $maxRows_rs_activebans);
  26. $rs_activebans = mysql_query($query_limit_rs_activebans, $b3connect) or die(mysql_error());
  27. $row_rs_activebans = mysql_fetch_assoc($rs_activebans);
  28. if (isset($_GET['totalRows_rs_activebans'])) {
  29. $totalRows_rs_activebans = $_GET['totalRows_rs_activebans'];
  30. } else {
  31. $all_rs_activebans = mysql_query($query_rs_activebans);
  32. $totalRows_rs_activebans = mysql_num_rows($all_rs_activebans);
  33. }
  34. $totalPages_rs_activebans = ceil($totalRows_rs_activebans/$maxRows_rs_activebans)-1;
  35. $queryString_rs_activebans = "";
  36. if (!empty($_SERVER['QUERY_STRING'])) {
  37. $params = explode("&", $_SERVER['QUERY_STRING']);
  38. $newParams = array();
  39. foreach ($params as $param) {
  40. if (stristr($param, "pageNum_rs_activebans") == false &&
  41. stristr($param, "totalRows_rs_activebans") == false) {
  42. array_push($newParams, $param);
  43. }
  44. }
  45. if (count($newParams) != 0) {
  46. $queryString_rs_activebans = "&" . implode("&", $newParams);
  47. }
  48. }
  49. $queryString_rs_activebans = sprintf("&totalRows_rs_activebans=%d%s", $totalRows_rs_activebans, $queryString_rs_activebans);
  50. ?>
  51. <html>
  52. <head>
  53. <title>Echelon - B3 Repository Tool (by xlr8or)</title>
  54. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  55. <style type="text/css">
  56. <!--
  57. @import url("css/default.css");
  58. -->
  59. </style>
  60. </head>
  61. <body>
  62. <div id="wrapper">
  63. <?php require_once('login/inc_loggedin.php'); ?>
  64. <?php include('Connections/inc_codnav.php'); ?>
  65. <table width="100%" class="tabeluitleg" cellspacing="0" cellpadding="0">
  66. <tr>
  67. <td align="center"><strong>Admin bans.</strong><br>
  68. You are viewing the bans/tempbans issued by admins. Clients can only reconnect
  69. when the ban has expired, never when a ban is permanent.</td>
  70. </tr>
  71. </table>
  72. <table width="100%" border="0" cellpadding="1" cellspacing="1">
  73. <tr>
  74. <td class="tabelkop">client&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=target_name&order=ASC"><img src="img/asc.gif" alt="ascending" width="11" height="9" border="0" align="absmiddle"></a>&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=target_name&order=DESC"><img src="img/desc.gif" alt="descending" width="11" height="9" border="0" align="absmiddle"></a></td>
  75. <td class="tabelkop">type&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=type&order=ASC"><img src="img/asc.gif" alt="ascending" width="11" height="9" border="0" align="absmiddle"></a>&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=type&order=DESC"><img src="img/desc.gif" alt="descending" width="11" height="9" border="0" align="absmiddle"></a></td>
  76. <td class="tabelkop">added&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=time_add&order=ASC"><img src="img/asc.gif" alt="ascending" width="11" height="9" border="0" align="absmiddle"></a>&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=time_add&order=DESC"><img src="img/desc.gif" alt="descending" width="11" height="9" border="0" align="absmiddle"></a></td>
  77. <td class="tabelkop">expires&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=time_expire&order=ASC"><img src="img/asc.gif" alt="ascending" width="11" height="9" border="0" align="absmiddle"></a>&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=time_expire&order=DESC"><img src="img/desc.gif" alt="descending" width="11" height="9" border="0" align="absmiddle"></a></td>
  78. <td width="200" class="tabelkop">reason&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=reason&order=ASC"><img src="img/asc.gif" alt="ascending" width="11" height="9" border="0" align="absmiddle"></a>&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=reason&order=DESC"><img src="img/desc.gif" alt="descending" width="11" height="9" border="0" align="absmiddle"></a></td>
  79. <td class="tabelkop">admin&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=admi_name&order=ASC"><img src="img/asc.gif" alt="ascending" width="11" height="9" border="0" align="absmiddle"></a>&nbsp;<a href="<?php echo $navThisPage; ?>?game=<?php echo $game; ?>&orderby=admi_name&order=DESC"><img src="img/desc.gif" alt="descending" width="11" height="9" border="0" align="absmiddle"></a></td>
  80. </tr>
  81. <?php do { ?>
  82. <tr class="tabelinhoud">
  83. <td title="ban id : <?=$row_rs_activebans['id']?>"><a href="clientdetails.php?game=<?php echo $game; ?>&id=<?php echo $row_rs_activebans['target_id']; ?>"><?php echo htmlspecialchars($row_rs_activebans['target_name']); ?></a></td>
  84. <td><?php echo $row_rs_activebans['type']; ?></td>
  85. <td><?php echo date('l, d/m/Y (H:i)',$row_rs_activebans['time_add']); ?></td>
  86. <td><?php
  87. if (($row_rs_activebans['time_expire'] <= time()) && ($row_rs_activebans['time_expire'] != -1)) {
  88. echo "<span class=\"expired\">".date('l, d/m/Y (H:i)',$row_rs_activebans['time_expire'])."</span>"; }
  89. if ($row_rs_activebans['time_expire'] == -1) {
  90. echo "<span class=\"permanent\">permanent</span>"; }
  91. if ($row_rs_activebans['time_expire'] > time()) {
  92. echo "<span class=\"active\">".date('l, d/m/Y (H:i)',$row_rs_activebans['time_expire'])."</span>"; }
  93. ?></td>
  94. <td width="200"><?php echo preg_replace('/\\^([0-9])/ie', '', $row_rs_activebans['reason']); ?></td>
  95. <td><a href="clientdetails.php?game=<?php echo $game; ?>&id=<?php echo $row_rs_activebans['admi_id']; ?>"><?php echo htmlspecialchars($row_rs_activebans['admi_name']); ?></a></td>
  96. </tr>
  97. <?php } while ($row_rs_activebans = mysql_fetch_assoc($rs_activebans)); ?>
  98. <tr class="tabelonderschrift">
  99. <td>click client to see details</td>
  100. <td>&nbsp;</td>
  101. <td>&nbsp;</td>
  102. <td><span class="expired">[expired ban]</span> <span class="active">[active
  103. ban]</span> <span class="permanent">[permban]</span></td>
  104. <td width="200">&nbsp;</td>
  105. <td>click admin to see details</td>
  106. </tr>
  107. </table>
  108. <table border="0" width="100%" cellspacing="0" cellpadding="0" align="center" class="recordnavigatie">
  109. <tr class="tabelkop">
  110. <td width="100%" colspan="4" align="center">Records:&nbsp;<?php echo ($startRow_rs_activebans + 1) ?>&nbsp;to&nbsp;<?php echo min($startRow_rs_activebans + $maxRows_rs_activebans, $totalRows_rs_activebans) ?>&nbsp;from&nbsp;<?php echo $totalRows_rs_activebans ?> </td>
  111. </tr>
  112. <tr>
  113. <td align="center" width="25%">
  114. <?php if ($pageNum_rs_activebans > 0) { // Show if not first page ?>
  115. <a href="<?php printf("%25s?pageNum_rs_activebans=%25d%25s", $currentPage, 0, $queryString_rs_activebans); ?>">First</a>
  116. <?php } // Show if not first page ?>
  117. </td>
  118. <td align="center" width="25%">
  119. <?php if ($pageNum_rs_activebans > 0) { // Show if not first page ?>
  120. <a href="<?php printf("%25s?pageNum_rs_activebans=%25d%25s", $currentPage, max(0, $pageNum_rs_activebans - 1), $queryString_rs_activebans); ?>">Previous</a>
  121. <?php } // Show if not first page ?>
  122. </td>
  123. <td align="center" width="25%">
  124. <?php if ($pageNum_rs_activebans < $totalPages_rs_activebans) { // Show if not last page ?>
  125. <a href="<?php printf("%25s?pageNum_rs_activebans=%25d%25s", $currentPage, min($totalPages_rs_activebans, $pageNum_rs_activebans + 1), $queryString_rs_activebans); ?>">Next</a>
  126. <?php } // Show if not last page ?>
  127. </td>
  128. <td align="center" width="25%">
  129. <?php if ($pageNum_rs_activebans < $totalPages_rs_activebans) { // Show if not last page ?>
  130. <a href="<?php printf("%25s?pageNum_rs_activebans=%25d%25s", $currentPage, $totalPages_rs_activebans, $queryString_rs_activebans); ?>">Last</a>
  131. <?php } // Show if not last page ?>
  132. </td>
  133. </tr>
  134. </table>
  135. <?php include "footer.php"; ?>
  136. </div>
  137. </body>
  138. </html>
  139. <?php
  140. mysql_free_result($rs_activebans);
  141. ?>