Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL ^ E_WARNING);
- $ref = @$_SERVER[HTTP_REFERER];
- $agent = @$_SERVER[HTTP_USER_AGENT];
- $ip = @$_SERVER['REMOTE_ADDR'];
- $host = "IP";
- $port = "PORT";
- $user = "USER";
- $password = "PASS";
- $dbname = "NAME";
- $tblname = "iplogging";
- $link = mysqli_connect ($host, $user, $password, $dbname, $port);
- $result = mysqli_query ($link, "USE $dbname");
- $result = "INSERT INTO iplogging(ref, agent, ip) VALUES ('$ref', '$agent', '$ip')";
- $exec = mysqli_query ($link, $result);
- ?>
- iplogging.php
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html lang="de">
- <head>
- <title>IP LOGS</title>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
- <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
- <style type="text/css">
- .alignright {
- float: right;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <div>
- <h2>IP LOGS</h2>
- </div>
- <?php
- //error_reporting(E_ALL ^ E_WARNING);
- $ref = @$_SERVER[HTTP_REFERER];
- $agent = @$_SERVER[HTTP_USER_AGENT];
- $ip = @$_SERVER['REMOTE_ADDR'];
- $host = "IP";
- $port = "PORT";
- $user = "USER";
- $password = "PASS";
- $dbname = "NAME";
- $tblname = "iplogging";
- $link = mysqli_connect ($host, $user, $password, $dbname, $port);
- $result = mysqli_query ($link, "USE $dbname");
- $result = "SELECT * FROM $tblname";
- $result .= " ORDER BY id";
- $exec = mysqli_query ($link, $result);
- echo "<table class=\"table table-hover table-bordered\">
- <thead>
- <tr>
- <th>ID</th>
- <th>REFERRER</th>
- <th>AGENT</th>
- <th>IP</th>
- <th>TIMESTAMP</th>
- <th>GEOLOCATION</th>
- <th>DELETE ENTRY</th>
- </tr>
- </thead>
- <tbody>";
- while($row = mysqli_fetch_array($exec, MYSQLI_BOTH)) {
- $country_code = trim(file_get_contents("http://ipinfo.io/$row[3]/country"));
- $host_name = trim(file_get_contents("http://ipinfo.io/$row[3]/hostname"));
- $city = trim(file_get_contents("http://ipinfo.io/$row[3]/city"));
- echo "
- <tr>
- <td>$row[0]</td>
- <td>$row[1]</td>
- <td>$row[2]</td>
- <td>$row[3]</td>
- <td>$row[4]</td>
- <td style=\"width: 25%;\">Location: $country_code, $city<br />Host: " . $host_name . "</a></td>
- <td><a href=" . "iplogger.php?id=" . $row[0] . "><button class=\"btn btn-danger\">DELETE</button></td>
- </tr>";
- }
- echo " </tbody>
- </table>";
- if(!empty($_GET['id'])){
- $tempid = $_GET['id'];
- $deleterow = mysqli_query ($link, "USE $dbname");
- $deleterow = mysqli_query ($link,"DELETE FROM $tblname WHERE id = " . $tempid);
- header('location: iplogger.php');
- }
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement