The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
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. |
#2
|
|||
|
|||
![]()
flag.txt should be 777
|
#3
|
|||
|
|||
![]()
Thank you for your response. Actually I tried it 777 and every combination that i can think of, and it didn't work. If i run the script file outside the vbulletin folder it works very well with just 644. Any other ideas?
|
#4
|
||||
|
||||
![]()
Change:
fopen($myFile, 'a') to: fopen($myFile, 'w') |
#5
|
|||
|
|||
![]()
Thank you for the response. I did and it did not work.
|
#6
|
||||
|
||||
![]()
Are you getting any errors at all when you run the code?
|
#7
|
|||
|
|||
![]()
No, error message, but when I tried another function:
echo file_put_contents(""XXXXXXXXXXXX/flag.txt","Hello World. Testing!"); i got this error message: " Warning: file_put_contents() [function.file-put-contents]: Only 0 of 5 bytes written, possibly out of free disk space in [path]/includes/cron/test.php on line 10 done" |
#8
|
||||
|
||||
![]()
You have double quotes at the beginning of this line. That might be the cause of your error.
""XXXXXXXXXXXX What are you using for the path? It should be like this: /home/yourname/public_html/forums |
#9
|
|||
|
|||
![]()
Sorry for the typing error. Actually in the original code there was no double quotes.
I am using this path: "http://Mydomain.com/forum/includes/cron/flag.txt" Is it correct? Also somebody said to clear the tmp folder in the server. --------------- Added [DATE]1283072597[/DATE] at [TIME]1283072597[/TIME] --------------- I changed the path and it works! I will try it with other function as well and see. Thank you very much Boofo, and Jaxel. |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|