I'm trying to create a simple waiting list and display to use a piece of equipment. Users will enter their name using a PHP form, and I can write the name to the end of a text file using something like this:
<?php
$name = $_GET['name'];
$fp = fopen("./name.txt", 'w');
if (!$fp)
{
echo '<html><body><p>Failed to open file.</body></html>';
exit;
}
$outputstring = "$name\r\n";
fwrite($fp, $outputstring, strlen($outputstring));
echo "\0";
end;
?>
I was planning to use PHP to read the text file, and pull off the name at the top of the list to display on a web site. However, I'm not sure if it is possible to delete the name once I request it from the text file. I'd also like to clear the text file daily. Are there better alternative ways to create this waiting list? What would you recommend instead?