Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. <?php
  2. // SrcSrv Index, no template
  3. // +-----------------------------------------------------------------------+
  4. // | Copyright (C) 2014, RebornServers |
  5. // +-----------------------------------------------------------------------+
  6. // | If you have this file, you're my buddy. Just do me a favor |
  7. // | and just don't give it out. All I request. |
  8. // +-----------------------------------------------------------------------+
  9. // | Author: Septharoth Revision: 1 |
  10. // +-----------------------------------------------------------------------+
  11.  
  12.  
  13. require 'config/srcSrv.CONFIG.php';
  14.  
  15. // Create the SQL Connection
  16. $sql = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
  17.  
  18. // Check for database errors
  19. if ($sql->connect_error) {
  20. die("[SrcSrv] Connection Failure! ".$sql->connect_error);
  21. } /* else {
  22. print("[SrcSrv] Connection Success!");
  23. } */
  24.  
  25. // Setup our table, this is for my SLN, so style it however you'd like.
  26. echo "<table><thead>
  27. <th> Name </th>
  28. <th> Gamemode </th>
  29. <th> Map </th>
  30. <th> Players </th>
  31. <th> Status </th>
  32. </thead>";
  33.  
  34. // Grab information on each server
  35.  
  36. $info = "SELECT * FROM ".$dbtable;
  37. $infoResult = $sql->query($info);
  38.  
  39. if ($infoResult->num_rows > 0) {
  40. // output the data from every row
  41. while($row = $infoResult->fetch_assoc()) {
  42. echo "<tr>
  43. <td>".$row['name']."</td>
  44. <td>".$row['mode']."</td>
  45. <td>".$row['map']."</td>
  46. <td>".$row['players']."/".$row['maxplayers']."</td>
  47. <td>".$row['status']."</td>
  48. </tr>";
  49. }
  50. } else {
  51. echo "Check your SQL, 0 results.";
  52. }
  53.  
  54. // Lets close our table and add anything to the footer.
  55.  
  56. echo "</tbody></table>";
  57. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement