01-03-2010, 09:28 AM
Hello Support Forums,
In this tutorial I will show you how to grab someone's IP Adress when they visit a website.
The variable to use is $_SERVER['REMOTE_ADDR'] - It's that simple. You can use it for just about anything, here are a few examples.
Printing the Users IP Address:
Printing it to a File:
Now, you have to make a new text file and insert any of these codes or your own and save it as "anything.php".
Good luck.
-Risto
In this tutorial I will show you how to grab someone's IP Adress when they visit a website.
The variable to use is $_SERVER['REMOTE_ADDR'] - It's that simple. You can use it for just about anything, here are a few examples.
Printing the Users IP Address:
PHP Code:
<?php
print ($_SERVER['REMOTE_ADDR'], "I'm Watching You!");
?>
Printing it to a File:
PHP Code:
<?php
$ip = $_SERVER['REMOTE_ADDR'];
$handle = fopen('ipaddresses.txt'', 'a+);
fwrite($handle, $ip); fwrite($handle, "\n");
fclose($handle);
?>
Now, you have to make a new text file and insert any of these codes or your own and save it as "anything.php".
Good luck.
-Risto