I seem to be in a predicament. I am currently working on a script that will allow me to do massive updates on files I choose.
An example use would be: Open up every file in a directory and change the word "after" to "before".
Now for the problem. After opening the file and making all the corrections, I need to be able to save the file. But, I cannot write to the file without chmodding it to 666. It would be a hassle to go through hundreds of files and chmod them to the appropriate levels.
I attempted to use this:
chmod("accac.htm", 666);
To allow me to write to the file, then I was going to chmod it back to default. But I get:
Warning: chmod(): Operation not permitted in /home/******/public_html/website/quickchange.php on line 50
I believe this has to do with being in safe mode. Does anyone know a way to possibly bypass this?
I would love any help. Thanks in advance.
-Matt