Advertisement
Guest User

Untitled

a guest
Mar 29th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Edit player</title>
  4. <style>
  5. table, th, td {
  6. border: 1px solid black;
  7. }
  8. </style>
  9. </head>
  10. <form method="post">
  11. <input type="hidden" name="player_id" value="<?php echo $_GET["player_id"]; ?>" />
  12. <input type="submit" name="ban" id="ban" value="Ban" /><br />
  13. </form>
  14. <body>
  15. </script>
  16. <?php
  17. $servername = "localhost";
  18. $username = "root";
  19. $password = "12345678";
  20. $dbname = "auroris";
  21.  
  22. $data["player_id"] = $_POST["player_id"];
  23. // $player_id = htmlspecialchars($_GET["player_id"]);
  24.  
  25. $conn = mysqli_connect($servername, $username, $password, $dbname);
  26. if($conn->connect_error) {
  27. die("Connection failed: " . $conn->connect_error);
  28. }
  29.  
  30. $sql = "SELECT * FROM penguins WHERE ID = " . $data["player_id"];
  31. $result = $conn->query($sql);
  32.  
  33. if($result->num_rows > 0) {
  34. echo "<table><tr><th>ID</th><th>Name</th><th>Password</th><th>Coins</th><th>Banned</th><th>LoginIPs</th></tr>";
  35. while($row = $result->fetch_assoc()) {
  36. echo "<tr><td>" . $row["ID"] . "</td><td>" . $row["Username"] . "</td><td>" . $row["Password"] . "</td><td>" . $row["Coins"] . "</td><td>" . $row["Banned"] . "</td><td>" . $row["LoginIPs"] . "</td></tr>";
  37. }
  38. echo "</table>";
  39. }
  40. function ban($player_id) {
  41. $timestamp = time() + (24 * 60 * 60);
  42. $sql = "UPDATE penguins SET Banned = " . $timestamp . " WHERE ID = " . $data["player_id"] . ";";
  43. echo $sql;
  44.  
  45. mysqli_query($conn, $sql);
  46. }
  47. if(isset($_POST["ban"])) {
  48. ban($data["player_id"]);
  49. }
  50. ?>
  51. </body>
  52. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement