I think you're talking about something like this...
Here's the function...
<?
function storyid()
{
$file = file('ids.txt');
$maxID = array_reverse($file);
if(!$maxID[0])
{
$fp = fopen('ids.txt','a+');
if($fp)
{
fwrite($fp,'00');
}
die('No story ID in DB.<br>Inserted a new ID.<br>Please refresh.');
}
$newID = $maxID[0] + 1;
$fp = @fopen('ids.txt','a+');
if($fp)
{
fwrite($fp,"\n" . $newID);
}
else
die('No permission to write in ID file.');
return $newID;
}
?>
Here's how you use the function...
<?
$story = 'bla bla bla bla bla bla';
$fp = @fopen('story' . storyid() . '.html','a+');
if($fp)
{
fwrite($fp,$story);
}
else
die('No permission to write in STORY file.');
?>