View Full Version : How can I create a login using a .txt or .csv file?
06-08-2005, 01:22 PM
First of all, sorry for the pathetic "I know nothing" tone of this quest, but ... er I know nothing and reading some of the other posts either confuses me or they don't quite fit the bill.
I have been given the task of making a secure area of our website but I don't have a database, so hopefully I can use a .txt or .csv file for authentication.
I will have a userbase of several thousand, all of whom have an allocated individual four figure login number but will be asked to choose their own password the first time.
I will need a login page which if succesful will redirect the to the "real" front page.
Is this feasable, or if not, any ideas?
I would, of course, like to explore PHP more but naturally enough they want all this yesterday.
Thanks for reading
06-08-2005, 02:01 PM
It's possible although without a database you are going to need to find some way to secure that flat file containing all the user data, whether by saving the file above the site root or securing it with .htaccess so we'd need to know more about what you can and can't do server-wise.
To be honest you will save yourself a lot of headaches using a database, even if it costs a little extra to implement.
If you need the work doing ASAP then you could always post in the work offers forum and pay someone to write it for you. It may be the best solution in the short term until you know a bit more about PHP and can script stuff yourself.
06-08-2005, 03:53 PM
I'm with delinear on this, a database will save you hours of time. Without it though, it is possible, if your looking at several thousand usable identifications, I'd go with an xml file for reading in this situation, it will be far easier to search though than going through each line of a cvs or text file. Now you still have a problem -> security. All of the mentioned files are readable by a browser without being locked down. chmod would be your friend in this situation, or you can use a .php extension so long the data is intact and outputed to the reading files correctly.
Let us know if you have a database, it will make it easier. Otherwise, we will need to explore other possible ideas.
06-08-2005, 04:05 PM
Thanks for your swift responses.
I am able to chmod a data file, and I could also save it above the root.
Maybe if I insist, I can get the punters to login with their surname and use their 4 figure number as their password rather than set their own. At least that would be on less variable.
The xml vaersion might be interesting. And a database may be an outside possibilty, but again I know nothing of them; never even used on as a punter (except unwittingly). I'd have to get help with that.
06-08-2005, 04:31 PM
If the database isn't an option, which is what I'd be going for, and your interested in xml version, I wish I had a straight forward tutorial for you, but I don't :(
XML is simple though, the language XML is so clear that anyone can use it. The problem comes to the supporting languages of XML, xpath, xsl, xslfo, etc.
Here is an example of an XML file:
There you go, a nice xml document! Its easy to create one either manually or dynamically, so no worries on how it will happen with several thousand entries, it would end up being a cinch.
Accessing it is a whole nother aspect though. You would need to give your php version so that the correct functions can be used, but it wouldn't be a problem to create a search and compare script for this. BTW, using xml you would then create a mini database for your information (minus the cool features of something like mysql of course ;)).
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.