dunno if this would work you may need t tweak it
<?php
$filename = '/path/to/foo.txt';
$somecontent="Write this to newly created file";
if (file_exists($filename)) {
fopen($filename, "r"); //Opens for reading only, [url]www.php.net/fopen[/url] for more functions
} else {
if (is_writable($filename)) {
// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
print "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (!fwrite($handle, $somecontent)) {
print "Cannot write to file ($filename)";
exit;
}
print "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
} else {
print "The file $filename is not writable";
}
}
?>
i pulled that outta php.net. see if it helps. If not thereare some good functions in there that you may wish to take a look at.
remember im fairly noob at this too🙂