I have a pre-registration data file ('tmp/data.txt') that I have to process 5 to 25 times a night at club meetings. Permissions are 644. I use an html web app to generate users' ID #'s.
sample: 10673062 12345678 etc.
After reading the file, it needs to be truncated to 0 bytes. I don't want to process the same ID #'s repeatedly.
I have tried every php trick in the book:
<script>
function remake() {
// do various js operations, then:
<?php $fh = fopen( 'tmp/data.txt', 'w' ); fclose($fh);?>
<?php file_put_contents("tmp/data.txt", "");?>
<?php $fp = fopen("tmp/data.txt", "w+"); ftruncate($fp, 0); fclose($fp);?>
// do more js stuff.
}
</script>
But the file remains intact. What do I have to do (chmod or chgrp possibly ?) to make the file accessible for truncation by php?
SOLVED: made an external php 'eraseRegs.php;' called it and it worked. Thanks!