Well first of all, that is a horrible idea, storing all your passwords in a text file that anybody can read. Even if not just anybody can read it, it's still a horrible idea.
But if you're intent on doing it that way, use
file to get every line of the file into an array (assuming you put one password per line). You might need to do array_map('trim', $your_array) to trim off new lines. Then, with the password entered which you want to check, use
in_array to check if the password is in the array of lines.
To delete, look into more array functions such as array_splice or a combination of array_search and unset to remove the value from the array, and implode to return the array to a big string. Storing it back to the file would use either fopen with PHP 4 or file_put_contents with PHP 5.
I would rather recommend using a database such as MySQL to store your passwords. If you do that, it's easy to just do a query for the password which can easily determine if it exists. Read more at
php.netThis post has been edited by Styx: 24 Jul, 2007 - 09:48 AM