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".