Jump to content

Help! Trying to create a counter..


dotBz

Recommended Posts

Hi, just wondering why my counter doesn't work:

<?php
 if (ini_set('auto_detect_line_endings', 1) === FALSE)
 {
 	echo "ERROR: Cannot set ini file.";
 	exit;
 }

 if ($ip = file('ipaddr', FILE_IGNORE_NEW_LINES))
 {
 	if (!in_array($_SERVER['REMOTE_ADDR'], $ip))
 	{
 		if ($handle = fopen('ipaddr', 'a'))
 		{
 			fwrite($handle, $_SERVER['REMOTE_ADDR'] . "\n");
 			fclose($handle);
 		} else echo "ERROR: Opening File.";
 	}	
 } else echo "ERROR: Reading file.";

?>

The 'ipaddr' file contains this:

0.0.0.0

I think I'm having trouble w/ newlines..

Any help would be appreciated.. Thanks!  ;D

Link to comment
https://forums.phpfreaks.com/topic/102900-help-trying-to-create-a-counter/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.