Help with PHP script that would read & delete a row from txt or csv file
I would need some help with a small problem.
I need to have a php script that would read a row from a txt file or csv file then display in an html file a random string and after it display this, it would delete it from the txt or csv file. I would like to use it to deliver pre-selected serial numbers and or usernames and passwords. i.e:
I don't know if there's a specific function within PHP to do what you want, I never found one but here's part of a little script I wrote to handle something similar. I've modified it so it should work with your text file (it would need changing to work with a csv file but for text files in the format name,password,serial<newline>name,password,serial<newline> etc it should work fine).
Instead of phsyically deleting a line from the file it reads the whole file into an array, breaks that array down into separate user details, displays and deletes the first user's details then puts the remaining details back into the file. Not the most efficient method, but it works
If I'm not giving too much trouble I would like to ask some more help about something else:
I would like to have a php script to run only if someone have the serial username and password. But this I would like to include them in a config.php file. So if the user insert these values in the config.php file then the script will run. But I don't want to use MySQL.
So let's say I have the script horoscope.php and the database.php file with the pre defined serials and usernames on another server or the same server in order for the horoscope.php file to run it must find the config.php file and the username,password, serial, must be correct against the database.php file. If not then the horoscope.php file must not run.
It has to be as simple as possible. Security is not an issue.
(the scripts will all be locked by codelock software that I have so the usernames will not show by users, or the database.php will be on an other server).
If the above is easy please help. If it takes to much time, I'll understand.
Any way thanks again in advance for your time and help.
Software is like sex. It's better when it's FREE!!!