Login page interfacing with flat file

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
Redcircle
Moderator
Moderator
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA
Contact:

Postby Redcircle » Mon Mar 03, 2003 12:35 am

My suggestion would be to put the information into the file a little different. 1 user for each line and seperate the information using a : or ; as a delimiter

1:user:pass
2:user:pass
3:user:pass
4:user:pass
5:user:pass

using this method will allow you to use the file() function.

This will read each line and put it into an array.

Code: Select all

$users = file('login.txt');

you can then use the explode function to extract the information from each line.

Code: Select all

$size = sizeof($users);
for($x=0; $x<$size; $x++)
{
$users[$x] = trim(explode(':',$users[$x]),':');
}

Return to “PHP coding => General”

Who is online

Users browsing this forum: Google [Bot] and 1 guest