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|[email protected]

Ben Turner|[email protected]

Jack Hack|[email protected]

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.