SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Jun 2002
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Reading Flat File for information

    Since I don't have access to a DB, I'm going to have to live with a flat file. So this is what I'm looking to do:

    On the server I'm going to have a file called beta.fh (just a text file) with this kind of information with it:

    Name1, Username1, Email1, FH2339
    Name2, Username2, Email1, FH4535
    etc...

    So with the php script, this information will be posted, then I need it to check if all 4 fields match, if not, forward you to a page that says "verification failed" and if it does match all for forward to a page that has a "verification sucessful"... I have NO idea where to start, so thats why I've posted here (since everyone is so helpful here) and I'd GREATLY appreciate if someone could help me code this.

  2. #2
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Get aquainted with these functions.
    file()
    explode()
    foreach()

    Learn how to use arrays
    Arrays

    That's a start for ya.

    Then basically, take the file in with file(), grab each instance of it and chop it up with explode. Then you'll be able to use your info.

    And foreach() will allow you to loop through an array and assign it to variables if you like.
    Last edited by Defender1; Sep 23, 2002 at 17:17.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  3. #3
    As the name suggests... trickie's Avatar
    Join Date
    Jul 2002
    Location
    Melbourne, Australia
    Posts
    678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are going to be using this file with a large number of users then it might be better to store the details with XML then use php's xml functions to read and manipulate the structure.

  4. #4
    Mlle. Ledoyen silver trophy seanf's Avatar
    Join Date
    Jan 2001
    Location
    UK
    Posts
    7,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're using files have a good read about flock() too

    Sean
    Harry Potter

    -- You lived inside my world so softly
    -- Protected only by the kindness of your nature

  5. #5
    SitePoint Member
    Join Date
    Jun 2002
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have *NO* clue how to go about this...

    could someone start me off?

  6. #6
    As the name suggests... trickie's Avatar
    Join Date
    Jul 2002
    Location
    Melbourne, Australia
    Posts
    678
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First off, if you want to use xml then you have to work out how you want to store info...

    If you are only going to keep a small amount of data for each person then you don't really have to worry about a DTD or a schema, but i recommend getting familiar with the concepts. check out the
    W3C site for some specs.

    Instead of repeating what is already said i recommend checking out the following tutes...

    Kevin Yank's tute at SitePoint

    Devshed tute

    There are also some good tutes on DTD, schemas and other xml stuff at devshed and SitePoint


Bookmarks

Posting Permissions

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