cleansedbb
Technical User
I have several text files. (and unfortunatly they need to be text instead of mysql)
the data is
Username1:MD5CryptedPassword
Username2:MD5CryptedPassword
Username3:MD5CryptedPassword
Username4:MD5CryptedPassword
I have an existing script that inserts by appending the
username and password at the bottom of these files. thing
is I've noticed no one bothered with a existing record
check.
How can i read in say "users.passwds" and check for
username2 before adding username2? and if it's there
error out with a message?
existing code:
filepath1-5 (since there are 5 files)
i.e. filepath1
$md = crypt($password);
$passwd = "$login:$md" . "\n";
$filepath1 = fopen($filepath1, "a" or die("Couldn't open PASSWD FILE for writing!"
fwrite($filepath1, $passwd);
fclose($filepath1);
TIA
the data is
Username1:MD5CryptedPassword
Username2:MD5CryptedPassword
Username3:MD5CryptedPassword
Username4:MD5CryptedPassword
I have an existing script that inserts by appending the
username and password at the bottom of these files. thing
is I've noticed no one bothered with a existing record
check.
How can i read in say "users.passwds" and check for
username2 before adding username2? and if it's there
error out with a message?
existing code:
filepath1-5 (since there are 5 files)
i.e. filepath1
$md = crypt($password);
$passwd = "$login:$md" . "\n";
$filepath1 = fopen($filepath1, "a" or die("Couldn't open PASSWD FILE for writing!"
fwrite($filepath1, $passwd);
fclose($filepath1);
TIA