Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // from http://www.xpertdeveloper.com/2011/09/get-real-ip-address-using-php/
- if (!empty($_SERVER["HTTP_CLIENT_IP"]))
- {
- //check for ip from share internet
- $ip = $_SERVER["HTTP_CLIENT_IP"];
- }
- elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
- {
- // Check for the Proxy User
- $ip = $_SERVER["HTTP_X_FORWARDED_FOR"];
- }
- else
- {
- $ip = $_SERVER["REMOTE_ADDR"];
- }
- // This will print user's real IP Address
- // does't matter if user using proxy or not.
- echo "ايبيك يا حمار ".$ip;
- $cip = $ip;
- $iptolocation = 'https://api.ipgeolocation.io/ipgeo?apiKey=c142ac7883294fe49dd958aa00cde096&ip='.$ip.'&fields=country_name,city';
- $creatorlocation = file_get_contents($iptolocation);
- ?>
- <?php
- if(isset($ip))
- {
- $data=$ip;
- $fp = fopen('ip.txt', 'a');
- fwrite($fp, " $creatorlocation ".date(" d/m/Y").date(" h:i:s")."\n");
- fclose($fp);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement