dotBz Posted April 25, 2008 Share Posted April 25, 2008 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! Link to comment https://forums.phpfreaks.com/topic/102900-help-trying-to-create-a-counter/ Share on other sites More sharing options...
MadTechie Posted April 25, 2008 Share Posted April 25, 2008 Whats the problem? "doesn't work" doesn't help much! the code looks okay to me Link to comment https://forums.phpfreaks.com/topic/102900-help-trying-to-create-a-counter/#findComment-527220 Share on other sites More sharing options...
dotBz Posted April 25, 2008 Author Share Posted April 25, 2008 Hmm, it seems to work with others but not mine. It always logs my ip address.. I'll try it with my host.. Link to comment https://forums.phpfreaks.com/topic/102900-help-trying-to-create-a-counter/#findComment-527435 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.