Hi I have a file which updates database. I use it for a cron job, but it also works if someone accesses it like this: http://myweb.com/files/file.php
And I concerned tha users can access it and mess with a database. Is there a way to hide it from users, but keep it so I can edit it and cron job can execute it?
You should keep it in a directory which in not web accessible. If you want to keep it in its current location, then in the code you can add a check to see it is is being called from browser or by crawlers (using user-agent, referrer, etc) and if it is called from browser or by crawlers display an error message else let it execute.