tags:

views:

23

answers:

1

when user submit the form need to export form data to text file.exporting username ,password and email from form data to text file for forgot password. please help us. Thanks & Regard pmms

+1  A: 

First, are you SURE you just want to write username and passwords to a file? This can be a huge security hole if you don't properly protect and encode this file. See also this stackoverflow question on how to store passwords (plus many similar questions on stackoverflow, use search box above).

That said, in it's simplest form you could just store the username plus the (encrypted) password as a line in the password file, seperated by some character that cannot occur in the username. For example, the file could look like:

adam:fsSDFf34afdfgf43
bob:Djz3fdsDF67FSjFG

In PHP5 you can use file_put_contents() instead of the standard fopen(), fwrite(), fclose() calls.

catchmeifyoutry