Hello there, this is the code <?php $iplogfile = "log.txt"; $fp = fopen($iplogfile, "a"); if ($fp) { fputs($fp, $_SERVER["REMOTE_ADDR"]." \n"); fclose($fp); } ?> PHP: Can someone help me how i can make if the $_SERVER["REMOTE_ADDR"] is aready on log.txt to dont add again the ip on log.txt Thanks
<?php $ip_log_file_name = "log.txt"; $ip_array = file($ip_log_file_name); $fp = fopen($ip_log_file_name, "a"); if ($fp && !in_array($_SERVER["REMOTE_ADDR"]." \n", $ip_array)) { fputs($fp, $_SERVER["REMOTE_ADDR"]." \n"); fclose($fp); } ?> PHP: