Malevolentia Posted April 14, 2008 Share Posted April 14, 2008 Recently got a PHP based script from a friend which I use on several of my sites to get the total visitors, total visits today and unique visits today. But the thing is that every day the script erases itself to 0 and its not supposed to happen. I'm not sure how to post the coding here and such but I can upload script to someone if they want to help me A site which has the script, for example is www.uma-fan.com and you see it on the left menu at the bottom. Quote Link to comment https://forums.phpfreaks.com/topic/100974-desperate-for-help-with-web-counter-script/ Share on other sites More sharing options...
AndyB Posted April 14, 2008 Share Posted April 14, 2008 The example is nice, but the underlying code is where the problem originates. Why not save the script with a .phps extension and upload it to your site, then post the URL for the .phps version. Quote Link to comment https://forums.phpfreaks.com/topic/100974-desperate-for-help-with-web-counter-script/#findComment-516414 Share on other sites More sharing options...
Malevolentia Posted April 14, 2008 Author Share Posted April 14, 2008 Never heard of phps but I guess you mean this http://www.uma-fan.com/rtoc.phps thats the main code which is its own php file. then the script uses a stats.txt and online.txt which you CHMOD to 777. http://www.uma-fan.com/README.txt this is the readme file For some reason is there a index.php file in the zip I got but I dont think its neccesarry to use and its not possible to use that code because I can't overwrite my own index.php http://www.uma-fan.com/index.phps That should be it and thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/100974-desperate-for-help-with-web-counter-script/#findComment-516862 Share on other sites More sharing options...
Malevolentia Posted April 15, 2008 Author Share Posted April 15, 2008 Anybody who wants to help? Quote Link to comment https://forums.phpfreaks.com/topic/100974-desperate-for-help-with-web-counter-script/#findComment-518028 Share on other sites More sharing options...
Malevolentia Posted April 17, 2008 Author Share Posted April 17, 2008 I hate to be a pain like this but does someone want to help? I could pay some perhaps to get it fixed. Quote Link to comment https://forums.phpfreaks.com/topic/100974-desperate-for-help-with-web-counter-script/#findComment-519319 Share on other sites More sharing options...
helraizer Posted April 17, 2008 Share Posted April 17, 2008 From what I can see it's because you're using $fp = fopen("./stats.txt","w"); the "w" is what's causing it to reset, because as it says in the manual 'w' - Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it. You want to use "a", which appends the file, so adds all the new data to the end of the existing instead of overwriting. $fp = fopen("./stats.txt","a"); 'a' - Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it. Sam Quote Link to comment https://forums.phpfreaks.com/topic/100974-desperate-for-help-with-web-counter-script/#findComment-519618 Share on other sites More sharing options...
Malevolentia Posted April 18, 2008 Author Share Posted April 18, 2008 Thank you so much!! <33 Gonna try it at once! Quote Link to comment https://forums.phpfreaks.com/topic/100974-desperate-for-help-with-web-counter-script/#findComment-520367 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.