Wasteland Stats

From Masa, 8 Years ago, written in PHP, viewed 494 times.
URL https://paste.tunestiga.com/view/22766e0c Shorturl Error: Input provided by user is not valid Embed
Download Paste or View Raw
  1. <html>
  2. <head>
  3.         <meta charset="utf-8">
  4.         <title>arma3.ddaygaming.com:2302 Wasteland stats</title>
  5.        
  6.         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
  7. </head>
  8.  
  9. <body>
  10.     <div class="container">
  11. <?php
  12. $dbaddress = "server_ip_here";
  13. $dbusername = "database_username";
  14. $dbpassword = "database_password";
  15. $dbname = "database_name";
  16. $con=mysqli_connect("$dbaddress","$dbusername","$dbpassword","$dbname");  //server address, username, password, dbname// Check connection
  17. {
  18. echo "Failed to connect to MySQL: " . mysqli_connect_error();
  19. }
  20.         //check order ascending or descending
  21.         if (isset($_GET["order"])) {
  22.                 $sort = $_GET["order"];
  23.                 if ($_GET["order"] == "asc"){
  24.                         $sort = "desc";
  25.                         $order = "asc";
  26.                 }
  27.                 else{
  28.                         $sort = "asc";
  29.                         $order = "desc";
  30.                 }
  31.         }
  32.        
  33.         //check filter
  34.         if (isset($_GET["name"])) {
  35.                 $name = $_GET["name"];
  36.                 }
  37.                         else {
  38.                         $name = "Name";
  39.                                 }
  40. $list=array('Name', 'BankMoney', 'CaptureCount', 'PlayerKills', 'AIKills', 'ReviveCount', 'DeathCount');
  41. if (in_array($name,$list))
  42. {
  43.         //variable ok
  44. }
  45.         else
  46.         {
  47.                 $name = "name";
  48.         }
  49.        
  50.        
  51.  
  52. $query = mysqli_query($con,"SELECT * FROM playerinfo a INNER JOIN playerstats p ON a.UID = p.PlayerUID ORDER BY $name $order");
  53.  
  54. ?><!--//echo "<table border='1'>-->
  55. <table class="table">
  56. <tr>
  57. <?php echo "<th><a href=\"?order=$sort&name=Name\">Player Name</a></th>";?>
  58. <?php echo "<th><a href=\"?order=$sort&name=BankMoney\">Money</a></th>";?>
  59. <?php echo "<th><a href=\"?order=$sort&name=CaptureCount\">Capture Count</a></th>";?>
  60. <?php echo "<th><a href=\"?order=$sort&name=PlayerKills\">Player Kills</a></th>";?>
  61. <?php echo "<th><a href=\"?order=$sort&name=AIKills\">AI Kills</a></th>";?>
  62. <?php echo "<th><a href=\"?order=$sort&name=ReviveCount\">Revives</a></th>";?>
  63. <?php echo "<th><a href=\"?order=$sort&name=DeathCount\">Deaths</a></th>";?>
  64. </tr>
  65. <!--//";-->
  66. <?php
  67.  
  68. while($row = mysqli_fetch_array($query))
  69. {
  70. ?><tr class="success"><?php
  71. echo "<td>" . $row['Name'] . "</td>";
  72. echo "<td>" . $row['BankMoney'] . "</td>";
  73. echo "<td>" . $row['CaptureCount'] . "</td>";
  74. echo "<td>" . $row['PlayerKills'] . "</td>";
  75. echo "<td>" . $row['AIKills'] . "</td>";
  76. echo "<td>" . $row['ReviveCount'] . "</td>";
  77. echo "<td>" . $row['DeathCount'] . "</td>";
  78. echo "</tr>";
  79. }
  80. echo "</table>";
  81.  
  82. ?>
  83. <a href="http://ddaygaming.com">©ddaygaming.com</a>
  84. </div>
  85. </body>
  86. </html>
  87.  

Reply to "Wasteland Stats"

Here you can reply to the paste above