![]() |
|
Simple PHP Code To Grab IP - Printable Version +- Sinisterly (https://sinister.li) +-- Forum: Coding (https://sinister.li/Forum-Coding) +--- Forum: PHP (https://sinister.li/Forum-PHP) +--- Thread: Simple PHP Code To Grab IP (/Thread-Simple-PHP-Code-To-Grab-IP) |
Simple PHP Code To Grab IP - §herlock - 07-09-2013 Make a php file named: anything.php Containing the following code within: Code: <html>
<?php
$file = "sinisterly.txt";
$f=fopen($file, 'a');
fwrite($f,$_SERVER['REMOTE_ADDR']."\n");
fclose($f);
?>
<p>File not found</p>
</body>
</html>Now in the same directory make a txt file named: sinisterly.txt Just send anyone to the anything.php hyperlink, and the script will automatically grab the person;s IP and will save it in sinisterly.txt RE: Simple PHP Code To Grab IP - i0xIllusi0n - 07-09-2013 or you could redirect instead of File Not Found. PHP Code: header('location: http://www.google.com/');
RE: Simple PHP Code To Grab IP - ticalico - 07-09-2013 Neat, good share §herlock. Well done. RE: Simple PHP Code To Grab IP - §herlock - 07-10-2013 (07-09-2013, 08:07 PM)i0xIllusi0n Wrote: or you could redirect instead of File Not Found. Indeed!! You can do it. |