When I run this section of code, the first part which creates a txt file and writes to it works ok. But when I go to alter the PHP file I run into a not enough permissions situation.
I have changed all file permissions through ftp as well as through php.
Ftp says its 777 and php says I don't have permsion.
Any thoughts?
Here is the code
if (file_exists("content/$fname.txt")) {
echo "File Name already in use please change the name.";
include 'page/newfooter.php';
die;
}
touch("content/$fname.txt");
$write = fopen("content/$fname.txt",'w');
fwrite($write, $content);
fclose($write);
$fp = fopen("content/$fname.txt", "r");
while (!feof($fp)) {
$line = fgets($fp, 1024);
print "$line <br>";}
$addflag = '<?php
$sname = $var[' . $fname . '];
if ($sname == 1)
{
$fp = fopen("content/' . $fname . '.txt", \"r\");
while (!feof($fp)) {
$line = fgets($fp, 1024);
print "$line<br>";}
}
?>';
if (is_writable("php_code/pull_content_flags.php")) {
$pullflags = fopen("php_code/pull_content_flags.php",'a');
fwrite($pullflags, $addflag);
}
else
{
echo "pull_content_flags.php not writeable.";
}