Last active
January 28, 2023 19:04
-
-
Save michaelnagy/5482206 to your computer and use it in GitHub Desktop.
Simple PHP script to get the user IP and writes it to the file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//get tht ip from the user | |
$ip=$_SERVER['REMOTE_ADDR']; | |
//open or create the file | |
$arquivo = fopen($filename, "a"); | |
if ($arquivo == false) { | |
die('Error message creating or opening the file.');} | |
//write to the file the IP from the user | |
if (!fwrite($arquivo, $ip."\n")) die('Error updating the file.');{ | |
echo 'Sucess.'; | |
fclose($arquivo); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment