| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/wst2024/wp-content/plugins/ip-tracker/ |
Upload File : |
<?php
/**
* Plugin Name: IP Tracker
* Plugin URI: -
* Version: 1.0
* Author: ZapBaLang
* Author URI: -
* Description: Allows you to check the user ip address
* License: -
*/
defined( 'ABSPATH') or die( 'No Access Allowed...' );
function ip_tracker($atts){
$ip_addr = null;
if(isset($_POST['submit'])){
$ip_addr = $_POST["ip_address"];
$url = "http://ip-api.com/json/" . str_replace(' ', '', $ip_addr);
$content = file_get_contents($url);
$json = json_decode($content);
if ($json->status == "fail") {
$result = '
<form action="" method="post">
<label>IP Address:</label><input type="text" name="ip_address"/>
<br/><br/>
<input type="submit" name="submit" value="Submit"/>
</form>
<br/>
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">IP Address</th>
<th scope="col">Status</th>
<th scope="col">Message</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">' . $json->query . '</th>
<th>' . $json->status . '</th>
<th>' . $json->message . '</th>
</tr>
</tbody>
</table>
<br/><br/>';
return $result;
} else {
$result = '
<form action="" method="post">
<label>IP Address:</label><input type="text" name="ip_address"/>
<br/><br/>
<input type="submit" name="submit" value="Submit"/>
</form>
<br/>
<table class="table table-bordered">
<thead>
<tr>
<th scope="col">IP Address</th>
<th scope="col">Country</th>
<th scope="col">Region Name</th>
<th scope="col">City</th>
<th scope="col">Zip</th>
<th scope="col">Latitude</th>
<th scope="col">Longitude</th>
<th scope="col">Timezone</th>
<th scope="col">ISP</th>
<th scope="col">Message</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">' . $json->query . '</th>
<th>' . $json->country . ' (' . $json->countryCode . ')</th>
<th>' . $json->regionName . '</th>
<th>' . $json->city . '</th>
<th>' . $json->zip . '</th>
<th>' . $json->lat . '</th>
<th>' . $json->lon . '</th>
<th>' . $json->timezone . '</th>
<th>' . $json->isp . '</th>
<th> public range </th>
</tr>
</tbody>
</table>
<br/><br/>';
return $result;
}
}
?>
<form action="" method="post">
<label>IP Address:</label><input type="text" name="ip_address"/>
<br/><br/>
<input type="submit" name="submit" value="Submit"/>
</form>
<?php
}
add_shortcode('iptracker','ip_tracker')
?>