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! Quote 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 Quote 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.. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.