mishwar222
08-29-2010, 03:24 AM
Hello there,
I am trying to write a task in php. In the end of the task, I need to write to a file called (flag.txt) which resides on my server. So far I couldnt make the code write to that file. I tried many ways but it doesnt work.
My code:
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
//the task code here
// now in the end I want to write to the file
$myFile = "XXXXXXXXXXXX/flag.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = "TRUE";
fwrite($fh, $stringData);
fclose($fh);
?>
The flag.txt permissions is 644, and the writing to a file code works out the vb, but when i put them in the task code they do work.
Thank you for the help.
I am trying to write a task in php. In the end of the task, I need to write to a file called (flag.txt) which resides on my server. So far I couldnt make the code write to that file. I tried many ways but it doesnt work.
My code:
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
if (!is_object($vbulletin->db))
{
exit;
}
//the task code here
// now in the end I want to write to the file
$myFile = "XXXXXXXXXXXX/flag.txt";
$fh = fopen($myFile, 'a') or die("can't open file");
$stringData = "TRUE";
fwrite($fh, $stringData);
fclose($fh);
?>
The flag.txt permissions is 644, and the writing to a file code works out the vb, but when i put them in the task code they do work.
Thank you for the help.