07-21-2011, 05:57 PM
[To see links please register here]
:epic:
Explanation:
$file = "ip.txt" is a variable saying file is a string containing "ip.txt"
$ip = $_SERVER['REMOTE_ADDR']; is a variable which gets a environment value. $_SERVER['REMOTE_ADDR'] will return your ip.
$handle = fopen($file, 'a'); Create a handle type variable for writing to the ip.txt. a handle is needed for both reading and writing. the 'a' is for appending. 'w' for overwriting. 'r' for reading.
fwrite($handle, "IP Address: "); uses the handle to write to that file saying "IP Adress: "
fwrite($handle, "$ip"); writes your ip adress stored in a variable to the file
fwrite($handle, "\n"); adds a New line to the file like <br> in HTML
fclose($handle); closes the handle in a variable and releases all resources
tell me if i missed anything :smile: