All the file functions can work all over the server, and can even work in diferent servers (if you got direct permissions, they work as in the local server, if not, you must send username/password to get permission).

As a rule, it is advisable to read/write all the files in the local server, in a directory outside of directories of the web server... But some hosts don't have that kind of setup and you can end up with writing to a directory inside the web space (which isn't advisable, specially because an outsider can have access of them - there are tricks to avoid that thru).

If required, you can add always the following in the begin of the file:

«
<?php
/*
»

and in the end:

«
*/
?>
»
That will end file snoopers from snooping your files content...

Cheers...
Luis Ferro
Teladigital.net

P.S.- a better option would be to write the content in a database but alas you are testing only ;)


paradiddles wrote:

greetings,

I am learning the basics of file processing, starting w/ how to write data to a file. So far, I've created the .txt file and wrote the code. This is all being done on my local windows 2k PC for practice. My question is, where should I save the .txt file? So far, my forms and .php files are in the www directory. To open the file in PHP, I'm using the fopen() function. Below is the code I've writen:

//info to be writen to file
$outputstring = $date."\t".$_POST["luminaireqty"]." luminairs \t" .$_POST['coffeeqty']." coffee tables \t".$_POST['hallqty'].
" hall tables \t\$".$total ."\t". $address."\n";

// open file for appending
@ $fp = fopen("../../orders/orders.txt", "a");

flock($fp, 2);

if (!$fp)
{
echo "<p><strong> Your order could not be processed at this time. "
."Please try again later.</strong></p></body></html>";
exit;
}

fwrite($fp, $outputstring);
flock($fp, 3);
fclose($fp);

echo "<p>Order written.</p>";


Thanks,

Patrick





----------------
"forget your lust for the rich man's gold. All that you need, is in your soul. You can do this if you try. All that I want for you my son, is to be satisfied"

~ Lynard Skynard



---
[This E-mail scanned for viruses by Declude Virus]


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to