# Only allow my PHP script to edit this file

**URL:** <https://forum.kirupa.com/t/only-allow-my-php-script-to-edit-this-file/303238>\
**Category:** programming\
**Created:** [January 17, 2010, 11:28am UTC](https://forum.kirupa.com/t/only-allow-my-php-script-to-edit-this-file/303238 "2010-01-17T11:28:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![IQAndreas](https://avatars.discourse-cdn.com/v4/letter/i/f08c70/32.png) [@IQAndreas](https://forum.kirupa.com/u/IQAndreas)\
**Post date:** [January 17, 2010, 11:28am UTC](https://forum.kirupa.com/t/only-allow-my-php-script-to-edit-this-file/303238/1 "2010-01-17T11:28:21Z")

</div>

I want to create a quick sortof “log” system in PHP that I can report to in case anything goes wrong.

I could use SQL or mailing for this, however, if one of those systems are down, I will never get the message, but it might also be a good idea to use one of those in conjunction with a log file.

How do I store/access my plain old TXT file so the PHP script is allowed to edit it, but not any malicious users? I’m pretty sure I can get the log.php to be protected from being accessed directly (via typing in it’s url in the browser)
