Jump to content

How do you search flat files for a particular string using php?


weuntouchable

Recommended Posts

Hi guys,

 

i just started learning php and i have some questions.

as a way to learn php, i decided to give myself a project that i can build up on as my knowledge of php increases (hopefully). what i have so far is a flat file database that stores the name and email address of a user. I am also able to view the data in a form of a table. I was thinking, if i want to make a login page for the users, how could i compare text from the textbox and text in the flat file itself.

 

for example:

 

the flat file database consists of (where "|" is a seperator)

 

John Smith|john@smith.net

Ben Turner|ben@turner.net

Jack Hack|jack@hack.net

etc...

 

if i wanted a login page where the user must already be a member in order to enter, how can i search the flat file for that particular user?

 

i.e.  if i type in Ben Turner, it should successfully login because the user is in the database, but if i type in Max Payne, it should not log in (maybe instead follow with an error message) because the user is not in the database yet.

 

 

any help will be greatly appreciated, as i said, i just started learning, and i have no idea on how to start tackling this problem.

 

 

thanks in advance

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.