Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.84 KB | None | 0 0
  1. <?php require_once 'engine/init.php'; include 'layout/overall/header.php';
  2. /*protect_page();
  3. admin_only($user_data);
  4. */
  5. if ($config['log_ip'])
  6. {
  7.     znote_visitor_insert_detailed_data(4);
  8. }
  9.  
  10. if(isset($_GET['action']) && isset($_GET['pid']))
  11. {
  12.  
  13.     $action = $_GET['action'];
  14.     $pid = $_GET['pid'];
  15.  
  16.     switch ($action) {
  17.         case 'clear_balance':
  18.             mysql_update("UPDATE `players` SET `balance`= 0 WHERE `id`=". $pid .";");
  19.             echo '<strong>The balance of player with ID = '. $pid . ' was set to zero.</strong><br>';
  20.             echo '<br><a href="admin_bans.php">Back to the banned players</a>';
  21.             return;
  22.             break;
  23.  
  24.         case 'to_temple':
  25.             mysql_update("UPDATE `players` SET `posx`= 0 WHERE `id`=". $pid .";");
  26.             mysql_update("UPDATE `players` SET `posy`= 0 WHERE `id`=". $pid .";");
  27.             mysql_update("UPDATE `players` SET `posz`= 0 WHERE `id`=". $pid .";");
  28.  
  29.             echo '<strong>The player with ID = '. $pid . ' was sent to his temple.</strong><br>';
  30.             echo '<br><a href="admin_bans.php">Back to the banned players</a>';
  31.             return;
  32.         break;
  33.  
  34.         case 'clear_ban':
  35.             mysql_delete("DELETE FROM `bans` WHERE `value`='". $pid ."' LIMIT 1;");
  36.             echo '<strong>The ban of player with ID = '. $pid . ' was removed.</strong><br>';
  37.             echo '<br><a href="admin_bans.php">Back to the banned players</a>';
  38.             return;
  39.  
  40.         break;
  41.        
  42.         default:
  43.             # code...
  44.             break;
  45.     }
  46.  
  47. }
  48.  
  49. $bans = 0;
  50.  
  51. if(isset($_GET['name'])) {
  52.    
  53.     $bans = mysql_select_multi("SELECT `a`.`type`, `a`.`expires`, `a`.`statement`, `b`.`id`,  `b`.`name`, `c`.`email`, `b`.`balance`, `c`.`name` AS `aac` FROM `bans` AS `a` INNER JOIN `players` AS `b` ON `a`.`value` = `b`.`id` INNER JOIN `accounts` AS `c` ON `b`.`account_id` = `c`.`id` WHERE `b`.`name` LIKE '%". $_GET['name'] ."%' ORDER BY `a`.`id` DESC LIMIT 30");
  54.  
  55. }
  56. else {
  57.     $bans = mysql_select_multi("SELECT `a`.`type`, `a`.`expires`, `a`.`statement`, `b`.`id`,  `b`.`name`, `c`.`email`, `b`.`balance`, `c`.`name` AS `aac` FROM `bans` AS `a` INNER JOIN `players` AS `b` ON `a`.`value` = `b`.`id` INNER JOIN `accounts` AS `c` ON `b`.`account_id` = `c`.`id` ORDER BY `a`.`id` DESC LIMIT 30");
  58. }
  59. ?>
  60. <h1>Banned Players</h1>
  61. <form action="" method="get">
  62.     Find players by name:<br>
  63.     <?php if(isset($_GET['name'])) {?>
  64.     <input type="text" name="name" value="<?php echo $_GET['name']; ?>">
  65.     <?php } else { ?>
  66. <input type="text" name="name" value="">
  67.     <?php } ?>
  68.     <input type="submit" value="Search"/>
  69. </form>
  70. <?php
  71.  
  72. if(!$bans) {
  73. ?>
  74. <p>There are no banned players at this time.</p>
  75. <?php } else { ?>
  76.  
  77. <br>
  78.  
  79. <?php if(isset($_GET['name'])) {?>
  80. <strong>Showing players with name like "<?php echo $_GET['name']; ?>".</strong>
  81. <?php } else { ?>
  82. <strong>Showing all the banned players.</strong>
  83. <?php } ?>
  84.  
  85. <table class="table table-striped table-hover">
  86. <tr class="yellow">
  87. <th><strong>Character Name</strong></th>
  88. <th><strong>Account Name</strong></th>
  89. <th><strong>Email</strong></th>
  90. <th><strong>Balance </strong></th>
  91. <th><strong>Expires</strong></th>
  92. </tr>
  93. <?php foreach($bans as $ban) {
  94. echo '<tr><td>'.$ban['name'].'</td><td>'.$ban['aac'].'</td><td>'.$ban['email'].'</td><td>'.$ban['balance'].'</td><td>'.date("m-d-Y H:i", $ban['expires']).'</td></tr>';
  95. } ?>
  96. </table>
  97. <h1>Actions</h1>
  98. <table class="table table-striped table-hover">
  99. <tr class="yellow">
  100. <th><strong>Character Name</strong></th>
  101. <th><strong>Clear Balance Button</strong></th>
  102. <th><strong>Clear Player Ban Button</strong></th>
  103. <th><strong>To Temple Button</strong></th>
  104. </tr>
  105. <?php foreach($bans as $ban) {
  106.     echo '<tr><td>'.$ban['name'].'</td>';
  107.  
  108.     echo '<td><a href="?action=clear_balance&pid='. $ban['id'] .'">Clear Balance</a></td>';
  109.     echo '<td><a href="?action=clear_ban&pid='. $ban['id'] .'">Clear Ban</a></td>';
  110.     echo '<td><a href="?action=to_temple&pid='. $ban['id'] .'">To Temple</a></td>';
  111.  
  112.     echo '</tr>';
  113. } ?>
  114. </table>
  115. <?php
  116. }
  117. include 'layout/overall/footer.php'; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement