Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Sep 2002
    Location
    Lincolnshire
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How can I create a login using a .txt or .csv file?

    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
    Never do today what you can put off until tomorrow, and maybe you won't have to do it at all.

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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.

  • #4
    New to the CF scene
    Join Date
    Sep 2002
    Location
    Lincolnshire
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Never do today what you can put off until tomorrow, and maybe you won't have to do it at all.

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    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:
    Code:
    <?xml version="1.0"?>
    <doc>
      <users>
        <user>
          <name>Username1</name>
          <password>U1Password</name>
        </user>
        <user>
          <name>Username2</name>
          <password>U2Password</name>
        </user>
        ..etc, etc.
      </users>
    </doc>
    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 ).


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •