Page 1 of 1
PHP Counter7 Resetting
Posted: Tue Apr 09, 2024 1:17 pm
by donjohnson24
Despite having had WWB for many years, I am an infrequent actual user, and with my advancing years, do tend to forget things - such a changing my new page
https://www.donjohnson24.co.uk/enambarg.php from html to php to get the counter to work - but I got there eventually. I was therefore delighted to see the Visits counter clocking up overnight from its initial value of 1 to about 85. However, after an update (using 'Publish all files') I saw that the page had reverted to only 1 visit. I wondered if I had missed protecting the Visits2.txt using the 'Don't Publish' tab in the Object Manager, but saw that this only applies to functions, not their component files. I do occasionally get updates not appearing to have been applied, which are usually resolved by clearing my browser cache, but in this case, the changes I had made
did appear.
This is not a big problem, but any comments from Pablo, or the other gurus here, would be appreciated so that I can prevent a re-occurrence - as I vaguely recall having the same situation on another web site some years ago.
Re: PHP Counter7 Resetting
Posted: Tue Apr 09, 2024 2:02 pm
by Pablo
The file 'Visits2.txt' is not be generated by the extension or any of the standard options in WWB. Normally, it is uploaded manually.
But maybe you have included the file in a file publisher object, so it get uploaded each time you update the page?
Re: PHP Counter7 Resetting
Posted: Tue Apr 09, 2024 2:38 pm
by donjohnson24
Pablo wrote: ↑Tue Apr 09, 2024 2:02 pm
The file 'Visits2.txt' is not be generated by the extension or any of the standard options in WWB. Normally, it is uploaded manually.
But maybe you have included the file in a file publisher object, so it get uploaded each time you update the page?
That makes sense - thanks for the usual fast response!
Re: PHP Counter7 Resetting
Posted: Wed Apr 17, 2024 11:33 am
by donjohnson24
Going back to this problem, my Visitors counter on my page
https://www.donjohnson24.co.uk/index.php reset to 1 when I used 'Publish all files'.
It seems that I created the Counter.txt file - containing '1' - on my PC and used the option to select that file when setting up the Extension, so when I published, the copy of the local file was uploaded.
To do things correctly, I
should have created Counter.txt on my
host, and just used 'Counter.txt' as the Counter Filename.
If that is the case, should the option to pick a local file NOT be available when setting up the Extension?
This might avoid confusing non-experts like me

Re: PHP Counter7 Resetting
Posted: Wed Apr 17, 2024 11:45 am
by Pablo
By default, the extension does not overwrite .
So, if the file is included in the upload then you may have added it manually to the page. For example, via a File Publisher object.
Re: PHP Counter7 Resetting
Posted: Wed Apr 17, 2024 6:14 pm
by donjohnson24
Well, when I have C:\Users\Don2\Documents\Donjohnson24Web\Counter.txt (containing 2) as the Counter filename and Publish all files, the Visitors counter on my page changes from 19000 to 2.
If I delete the preceding text so that the filename is just Counter.txt and republish, the page counter stays at 2
If I manually amend the Counter.txt file on the host back to 19000 and re display the page, the counter shows 19000
If I publish again, the counter stays at 19000.
As you say, by default the extension does not overwrite, but it seems that it will upload a local file if specified in the Counter filename.
Anyway, that's what appeared to be happening when I just performed the above steps.
Re: PHP Counter7 Resetting
Posted: Wed Apr 17, 2024 7:40 pm
by Pablo
The file should not be uploaded by the software. It should only be done by your manually once.
If you need help with this then please share a DEMO project (.wbs file) so I can see all your settings.
I do not need the complete project because that will only take more time to figure out what you have done.
Basically, I just need a small project with one page and object(s) that are relevant to your question.
For further details about how to share a project file, please see this FAQ:
viewtopic.php?f=10&t=82134
Re: PHP Counter7 Resetting
Posted: Wed Apr 17, 2024 8:44 pm
by donjohnson24
I thought that the steps I had recorded in my previous post would have been simple to replicate and therefore test what I was trying to point out,
and that passing on my findings might be helpful.
I have resolved the matter to my own satisfaction, so do not need further help with this.