Page 1 of 1

login form handling using text files

Posted: Sun Jun 06, 2010 11:22 am
by Lamintun
Hi..
I am a beginner..
Could someone please help me out for loging form handling without using database.. I mean I wanna save data from user registration form to a text file(e.g username, password etc).. After that, I wanna use that text file for login validation..

What Im trying to do is saving data from registration form into an php array and write em back to a text file.. And then, I will retrieve the information from the array to validate the login information ( username and password).. But I am facing the problem of saving data into array..

I know its for my lack of programming knowledge. Could someone please help me?

Re: login form handling using text files

Posted: Sun Jun 06, 2010 12:21 pm
by Jonah Bron
Why don't you want to use a database?

Re: login form handling using text files

Posted: Sun Jun 06, 2010 1:07 pm
by Jonah Bron
Lamintun wrote:Hi, Jonah..

Actually Im working on for my assignment in my college.. I can only use text files for doing this.. Could you please help me with this?
Thank you for your reply. :)

Rgds,
Lamin.
Okay. Well, you have a few options. You can serialize() the array and write it to the file, or you can use XML. For just a school project, using serialize() would be easier. Just put everything you get from the signup page in the $_POST or $_GET variables into a hash, serialize() it, and then write it to a new line in the file with fopen() and fwrite(). All functions here are links to the manual.