Hi
on my hosting account php run as nobody , and since my user is "myhost"
I have no poissibility to chmod a file which is 644 , or no possibility to
fopen with write option , a files which has 644 permission.
OK , now I don't want leave the txt file always to 777 .
So is there any way to modify the txt file using php ftp functions available in php 4.x ?.
On details , my file below works only if users.db has been set to 777 .
I don't want this file always to be set to 777 , so is there any way to use below code with php ftp functions and leaving the file to 644 ?
$data_file = "users.db";
$data = file($data_file);
$count = count($data);
$fdata = fopen($data_file, 'w');
if ($fdata) {
for ($x = 0; $x < $count; $x++)
{
if (!empty($data[$x]))
{
if ( ereg($account,$data[$x]) && ereg($username,$data[$x]) )
{
$data[$x] = str_replace($name, $new_name, $data[$x]);
echo " user Changed!";
}
}
fwrite($fdata, $data[$x]);
}
fclose($fdata);
I tried to use
$fdata = fopen("ftp://myuser:password@myhost.com/users.db", 'w');
instead of
$fdata = fopen($data_file, 'w');
But I receive this error , failed to open stream: FTP server reports 213 9320
Anyone have a solution ?
Thank you