How to add a php script to .htaccess that, when accessing any php | html, except for the index.php file, would imperceptibly perform some kind of action. For example, I entered a log, how many times a particular file was opened (just wondering what to add to .htaccess, and I will add the php script myself).
The goal is this, there is a website in it a bunch of php or html files, all of them are loaded by indexing in index.php. And sometimes left-side files appear on the site, for example, system.php, which is viral and from time to time this script is run from a certain IP address and infection of all files begins. I would like to find all php files that run not through index.php, but directly.
Blocking the ip address, checking the user agent and where it came from, checking computers, changing passwords on ftp, websites, cleaning the virus and much more has already been done, I don’t have more strength: ((