Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $ip = getenv('HTTP_CLIENT_IP')?:
- getenv('HTTP_X_FORWARDED_FOR')?:
- getenv('HTTP_X_FORWARDED')?:
- getenv('HTTP_FORWARDED_FOR')?:
- getenv('HTTP_FORWARDED')?:
- getenv('REMOTE_ADDR');
- $servername = "localhost";
- $username = "user";
- $password = "password";
- $db = "serverips";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $db);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $query = "SELECT * FROM ips WHERE 'IP'='$ip'";
- $result = $conn->query($query);
- if ($conn->mysqli_num_rows($result) > 0) {
- $chkip = "Protected";
- }
- else {
- $chkip = "Unprotected";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement