Depending on your server, you can either implement the scheduled task (Windows) or CRON Job (Linux). This will be what allows your script to execute at a specific time of day (or night).
As for the counter, you can implement this in several ways. For data integrity and security, I would store the value in the database. To increase, select a value and increase it (there are also some ways, depending on your DBMS, to do this with a single SQL query). Otherwise, you can always edit the configuration file with I / O commands in PHP.
Setting up a CRON job / scheduled task
If you give me more information about your server configuration, I can give you specific tutorials on where you can learn how to set up your task.
Once you find out, you'll want to call a specific script. Your script in PHP can be configured as follows:
Compare the current D / M / Y with the previous days, most likely stored in your database or configuration file. If this happens, update your database / file by performing any analytical steps that you consider appropriate.
source share