December 3, 201213 yr Hi, so I use a PHP hit counter on my website http://www.fifamatchgenerator.com to keep track of how many matches have been generated. But for some reason, once it moves past 15,000 it resets. I then have to go into the log file and manually put a number back in from memory. Its annoying because if someone is viewing the site for thr first time and see the reset counter, they will not think the site is used very much, when im actually getting around 1000 views a month... Could someone with a little more knowledge look through the code and see if there is anything there which couls cause the reset? <?php // URL of the folder where script is installed. INCLUDE a trailing "/" !!! $base_url = ''; // Default image style (font) $default_style = 'web1'; // Default counter image extension $default_ext = 'png'; // Count UNIQUE visitors ONLY? 1 = YES, 0 = NO $count_unique = 0; // Number of hours a visitor is considered as "unique" $unique_hours = 24; // Minimum number of digits shown (zero-padding). Set to 0 to disable. $min_digits = 0; ############################# # DO NOT EDIT BELOW # ############################# /* Turn error notices off */ error_reporting(E_ALL ^ E_NOTICE); /* Get page and log file names */ $logfile = 'logs/test.txt'; /* Get style and extension information */ $style = input($_GET['style']) or $style = $default_style; $style_dir = 'images/styles/' . $style . '/'; $ext = input($_GET['ext']) or $ext = $default_ext; /* Does the log exist? */ if (file_exists($logfile)) { /* Get current count */ $count = intval(trim(file_get_contents($logfile))) or $count = 0; $cname = 'gcount_unique_'.$page; if ($count_unique==0 || !isset($_COOKIE[$cname])) { /* Increase the count by 1 */ $count = $count + 1; $fp = @fopen($logfile,'w+') or die('ERROR: Can\'t write to the log file ('.$logfile.'), please make sure this file exists and is CHMOD to 666 (rw-rw-rw-)!'); flock($fp, LOCK_EX); fputs($fp, $count); flock($fp, LOCK_UN); fclose($fp); /* Print the Cookie and P3P compact privacy policy */ } /* Is zero-padding enabled? */ if ($min_digits > 0) { $count = sprintf('%0'.$min_digits.'s',$count); } /* Print out Javascript code and exit */ $len = strlen($count); for ($i=0;$i<$len;$i++) { echo '<img src="'.$base_url . $style_dir . substr($count,$i,1) . '.' . $ext .'" border="0" />'; } } else { die('ERROR: Invalid log file!'); } /* This functin handles input parameters making sure nothing dangerous is passed in */ function input($in) { $out = htmlentities(stripslashes($in)); $out = str_replace(array('/','\\'), '', $out); return $out; } ?> Thanks
December 3, 201213 yr Really serious doupt ur getting 1000 views per month your site only has 15 results in google you can do site:fifamatchgenerator.com/ to see that and an alexa ranking of over 19 million which is not good at all and lastly you have a google page rank of 0 so idk where you think you get 1000 views a month but i think your counter may be wayyyyyyyyyy off either that or its just robots that visit your site
December 3, 201213 yr Author uhhh, the counter is to track matches generated, not page views!! In the first month of this year's version of the match generator, 10,000 matches were generated... Also, could you please try and stick to the questions and not drift away to your own personal doubts. I posted to get some help, not to be told that im lying. The page doesn't need a good SEO rating, just type into google "fifa random match" or "fifa random generator" im top...also my app is known on forums etc... thanks for you help... Edited December 3, 201213 yr by person4659
December 3, 201213 yr I couldn't really find an answer. The only statement that can cause the reset is this one: $count = intval(trim(file_get_contents($logfile))) or $count = 0; If the logfile fails to load one time in all the times your page is loaded by users the counter will reset. I don't really think this is the problem because the log file is very small, but it is just a guess because I can't find any bugs. Léon
December 3, 201213 yr uhhh, the counter is to track matches generated, not page views!! In the first month of this year's version of the match generator, 10,000 matches were generated... Also, could you please try and stick to the questions and not drift away to your own personal doubts. I posted to get some help, not to be told that im lying. The page doesn't need a good SEO rating, just type into google "fifa random match" or "fifa random generator" im top...also my app is known on forums etc... thanks for you help... yea i know your top because your typing in the exact name of your domain lol its a freedom of speech forum was just freely stating my thoughts but hope u find ur answer
December 4, 201213 yr Author Totally off topic here but ... A low PR does not mean he'll getting few views. I have a client with a stupidly successful ecommerce store that only has a root PR of 2, yet is averaging 5k plus unqiue visits per month plus his site is mentioned in a few choice places where his customers are. Just like the OP, who says the site is mentioned on relevant forums - a huge source of traffic. Don't be so quick to dismiss a site just because it a has a PR of 0 If the site offers something people from that niche want then it will have 0 issues getting traffic. agreed, thank you!
December 4, 201213 yr agreed, thank you! yea im more talking about ur lack of results in google imagine 15 results out of millions of sites if you calculate the odds well enough the odds of your site being found other then on the forums u post it on is probably 0 to none. either way this really is off topic so carry on gents
Create an account or sign in to comment