Quote:
Originally Posted by kh99
I think this should work:
Code:
$ourFileName = $vbulletin->options['thefile'];
if (!file_exists($ourFileName)) {
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);
}
but you probably wouldn't want the "or die()" part because that would leave you with a white page with an error message. You could do something like this:
Code:
$ourFileName = $vbulletin->options['thefile'];
if (!file_exists($ourFileName))
{
$ourFileHandle = fopen($ourFileName, 'w');
if ($ourFileHandle === FALSE)
{
// Do something here to handle error
}
else
{
fclose($ourFileHandle);
}
}
Also, using "w" in the fopen call will truncate the file (make it empty), so if you don't want that, use either "r" or "a".
|
as long as its writeable its fine, the idea of this $ourFileName is that it shows a log
this worked for the end user but not the admin
what was happening was the following
1) user visited forum
2) if variable was true, it wrote to the $ourFileName
3) but some admins could not create this file automacially
( for me it worked ) for another website ( admin did not work )
i will use the above code to see how today goes with it