Advertisement
Guest User

WebManager by Slluxx - modified by Oskarr

a guest
May 16th, 2017
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.43 KB | None | 0 0
  1. <?php
  2. // Settings
  3. $website_title="WebManager";
  4. $website_header="WebManager";
  5.  
  6. // Edit this to your own server details (last one doesnt need a , at the end).
  7. $serverinfo = array
  8. (
  9. // array("ID","NAME","IP","PORT","RCONPASSWORD"). First server id is always 0!
  10. array("0","NAME","127.0.0.1","30120","PASSWORD"),
  11. );
  12.  
  13. // Messages for kick & ban
  14. $kickmessage = "You got kicked by an admin. You should know why. If not, ask an admin at Discord.";
  15. $banmessage = "You got banned by an admin. You should know why. If not, ask an admin at Discord.";
  16.  
  17.  
  18. // DO YOUR LOGIN PROTECTION HERE
  19.  
  20.  
  21.  
  22. // DONT EDIT AFTER HERE
  23. require("./rcon/q3query.class.php");
  24. if (isset($_GET['action'])) {
  25. $action = $_GET['action'];
  26. $user_id = $_GET['uid'];
  27. $server_id = $_GET['sid'];
  28. $message = $_POST['message'];
  29.  
  30.  
  31. // Check for action in url, imports the variables and do command.
  32. if($action == "kick") {
  33.  
  34. foreach ($serverinfo as $server) {
  35. if($server['0'] == $server_id){
  36.  
  37. $con = new q3query($server['2'], $server['3'], $success);
  38. if (!$success) {
  39. die ("Fehler bei der Verbindungherstellung");
  40. }
  41. $con->setRconpassword($server['4']);
  42. $con->rcon("clientkick $user_id $kickmessage");
  43. echo "You successfully should have kicked the user with ID $user_id. Redirect after 3 seconds.";
  44. header( "refresh:3;url=index.php" );
  45. die();
  46. }
  47. }
  48. } else if ($action == "ban") {
  49. foreach ($serverinfo as $server) {
  50. if($server['0'] == $server_id){
  51. $con = new q3query($server['2'], $server['3'], $success);
  52. if (!$success) {
  53. die ("Fehler bei der Verbindungherstellung");
  54. }
  55. $con->setRconpassword($server['4']);
  56. echo $con->rcon("tempbanclient $user_id $banmessage");
  57. echo "You successfully should have banned the user with ID $user_id. Redirect after 3 seconds.";
  58. header( "refresh:3;url=index.php" );
  59. die();
  60. }
  61. }
  62. } else if ($action == "money") {
  63. foreach ($serverinfo as $server) {
  64. if($server['0'] == $server_id){
  65. $con = new q3query($server['2'], $server['3'], $success);
  66. if (!$success) {
  67. die ("Fehler bei der Verbindungherstellung");
  68. }
  69. $con->setRconpassword($server['4']);
  70. echo $con->rcon("setmoney $user_id 1000000");
  71. echo "You successfully should have set 1,000,000 $ to the user with ID $user_id. Redirect after 3 seconds.";
  72. header( "refresh:3;url=index.php" );
  73. die();
  74. }
  75. }
  76. } else if ($action == "money1") {
  77. foreach ($serverinfo as $server) {
  78. if($server['0'] == $server_id){
  79. $con = new q3query($server['2'], $server['3'], $success);
  80. if (!$success) {
  81. die ("Fehler bei der Verbindungherstellung");
  82. }
  83. $con->setRconpassword($server['4']);
  84. echo $con->rcon("setmoney $user_id 10000000");
  85. echo "You successfully should have set 10,000,000 $ to the user with ID $user_id. Redirect after 3 seconds.";
  86. header( "refresh:3;url=index.php" );
  87. die();
  88. }
  89. }
  90. }
  91. ?>
  92.  
  93. <!DOCTYPE html>
  94. <html lang="en">
  95. <head>
  96. <meta charset="utf-8">
  97. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  98. <meta name="viewport" content="width=device-width, initial-scale=1">
  99. <meta name="description" content="Status mamanger for fivereborn server">
  100. <meta name="author" content="Slluxx">
  101. <title><?php echo $website_title; ?></title>
  102. <link rel="stylesheet" href="https://bootswatch.com/flatly/bootstrap.min.css">
  103. <style>
  104. .footer {
  105. position: absolute;
  106. bottom: 0;
  107. width: 100%;
  108. /* Set the fixed height of the footer here */
  109. height: 60px;
  110. line-height: 60px; /* Vertically center the text there */
  111. background-color: #f5f5f5;
  112. }
  113. </style>
  114. </head>
  115. <body>
  116. <div class="container">
  117. <div class="row">
  118. <div class="col-md-12">
  119. <center>
  120. <h1><?php echo $website_header; ?></h1>
  121. </center>
  122. </div>
  123. </div>
  124. <div class="row">
  125.  
  126. <?php
  127.  
  128. foreach ($serverinfo as $server) {
  129. echo "<div class='row'>";
  130. echo "<div class='col-md-12'>";
  131. $con = new q3query($server['2'], $server['3'], $success);
  132. if (!$success) {
  133. die ("Fehler bei der Verbindungherstellung");
  134. }
  135. $con->setRconpassword($server['4']);
  136.  
  137. $server_players_array=explode("\n",$con->rcon("status"));
  138. $xpop = array_pop($server_players_array);
  139. $server_players_total = count($server_players_array);
  140.  
  141. echo "<b>".$server['1']."</b>";
  142. echo "<table class='table table-condensed table-bordered'>
  143. <thead>
  144. <tr>
  145. <th>ID</th>
  146. <th>Name</th>
  147. <th>SteamID</th>
  148. <th>IP</th>
  149. <th>Ping</th>
  150. <th>KICK</th>
  151. <th>BAN</th>
  152. <th>MONEY</th>
  153. </tr>
  154. </thead>
  155. <tbody>";
  156.  
  157. // Splitting the multiple lines of status command into arrays and split them into arrays seperated by " "
  158. // the mess is because playernames can have spaces. So we remove every entry before and after name
  159. // and put the rest together as name string.
  160. foreach ($server_players_array as $server_player) {
  161. $playerinfo=explode(" ",$server_player);
  162. $player_id = array_shift($playerinfo);
  163. $player_ipsteam = array_shift($playerinfo);
  164. $player_ipsteam2 = explode(":", $player_ipsteam);
  165. if($player_ipsteam2[0] == "steam"){
  166. $player_ipsteam3 = $player_ipsteam2[1];
  167. }else{
  168. $player_ipsteam3 = "-";
  169. }
  170. $player_ping = array_pop($playerinfo);
  171. $player_ip = array_pop($playerinfo);
  172. $player_name = implode(" ", $playerinfo);
  173. echo "<tr>
  174. <td>$player_id</td>
  175. <td>$player_name</td>
  176. <td>$player_ipsteam3</td>
  177. <td>$player_ip</td>
  178. <td>$player_ping</td>
  179. <td><a href='index.php?action=kick&uid=$player_id&sid=$server[0]' class='btn btn-warning btn-xs'> KICK</a></td>
  180. <td><a href='index.php?action=ban&uid=$player_id&sid=$server[0]' class='btn btn-danger btn-xs'> BAN</a></td>
  181. <td><a href='index.php?action=money&uid=$player_id&sid=$server[0]' class='btn btn-success btn-xs'> Set to 1,000,000$</a> <a href='index.php?action=money1&uid=$player_id&sid=$server[0]' class='btn btn-success btn-xs'> Set to 10,000,000$</a></td></tr>
  182. </tr>";
  183. }
  184. echo "</tbody>
  185. </table>";
  186. echo"</div>";
  187. echo"</div>";
  188. }
  189. ?>
  190. <br>
  191.  
  192. </div>
  193.  
  194.  
  195. </div><!-- /.container -->
  196. <footer class="footer">
  197. <div class="container">
  198. <span class="text-muted">Made with by <a href="https://github.com/Slluxx">Slluxx</a> Modified by Oskarr.</a></span>
  199. </div>
  200. </footer>
  201. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  202. </body>
  203. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement