View Full Version : files
tricolaire
12-27-2005, 05:13 PM
is there a way to write information to a file on teh server? perl style filehandles if you will? This information would likely be coming from $_POST
thanks
devinemke
12-27-2005, 05:33 PM
fopen (http://www.php.net/fopen)
fwrite (http://www.php.net/fwrite)
Velox Letum
12-27-2005, 08:05 PM
Also, look into file_get_contents() (http://www.php.net/function.file-get-contents) and file_put_contents() (http://www.php.net/function.file-put-contents), though, file_put_contents() is only available in PHP5. It's identical to using fopen(), fwrite(), and fclose().
If magic_quotes_gpc is enabled on your server, any POST data will be automatically escaped. If you don't want this written into your code, look into stripslashes().
if (get_magic_quotes_gpc()) {
$data = stripslashes($data);
}
// Then write
marek_mar
12-27-2005, 08:10 PM
...(such as no ability to open a file to append the written content, rather than overwriting).
It allowes appending. You use the FILE_APPEND flag to append.
Velox Letum
12-27-2005, 08:12 PM
It allowes appending. You use the FILE_APPEND flag to append.
Ah my mistake. I apologize, I'll have to reread the manual entry.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.