Hello.
I did a search and found some similar solutions to my problem, but none that would do what I need.
I have written a script that writes FORM data to a file. Each time the Form is submitted, a new line is created. What I want to do, is after a line is created, give the user the ability to delete that exact same line.
I am going to use this as sort of a "Who's Online" type thing. When someone logs in to the game, they click a button which writes their username to a file. Then when they are done with the game, they click another button and it deletes their username from the file. Writing the data has been no problem, but I cannot figure out how to find a specific line and deleting that line.
Any help would be nice. Below is what I am using to write the file if it helps. Ad the Form is just a simple POST form that POST's to this script(saveResults.php).
Thanks,
Brandon
<?
//Open the results.txt file where you want to write this information
$myFile = fopen("82nd.dat", "a");
//If it can't be opened quit
if (!($myFile)) {
print("file could not be opened");
exit;
}
//Build the string we want to write to the file
$str = "$handle\n";
//Write the string to the file
fputs($myFile, $str);
//Close the file
fclose($myFile);
?>