Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php
  2. // Create connection
  3. $servername = "localhost";
  4. $username = "root";
  5. $password = "Skid4Life";
  6. $dbname = "AntiBotServers";
  7. $conn = new mysqli($servername, $username, $password, $dbname);
  8.  
  9. $ip = $conn->real_escape_string($_GET['ip']);
  10.  
  11. if ($conn->connect_error) {
  12. die();
  13. }
  14.  
  15. $sql = "CREATE TABLE IF NOT EXISTS Servers (id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY,IP VARCHAR(30) NOT NULL)";
  16. $conn->query($sql);
  17.  
  18. $sql3 = "SELECT id FROM Servers WHERE IP = '$ip'";
  19. $result = $conn->query($sql3);
  20.  
  21. if ($result->num_rows == 0) {
  22. echo "0 results";
  23. $sql2 = "INSERT INTO Servers (IP) VALUES ('$ip')";
  24. $conn->query($sql2);
  25. }
  26.  
  27. $conn->close();
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement