DaveHope
asked on
Flatfile login system.
Hello all, i'm making the move from ASP to PHP, especially since I moved from window to linux. Anyway, I'm looking at writing a flat-file login system, unfortunatley, i'm stumped. The actual login data file would look like this:
[USER=Dave]
PASSWORD=password
DATA=0
OTHERDATA=0
HOMEPAGE=http://localhos
and then the next user and so on and so forth. So far, i'm reading each user into an array, like so:
<?php
$filename = "accounts";
fclose(fopen($filename,"r" ));
$struser = explode("[USER=",fread(fop en($filena me,"r"), filesize($filename)));
echo $struser[1];
echo "<br />";
echo $struser[2];
?>
The next step, I guess, would be to get the line "PASSWORD=" and see if it corresponds to the relevant username entered into the form. This is where I loose it ;P, any help would be GREATLY appreciated!
[USER=Dave]
PASSWORD=password
DATA=0
OTHERDATA=0
HOMEPAGE=http://localhos
and then the next user and so on and so forth. So far, i'm reading each user into an array, like so:
<?php
$filename = "accounts";
fclose(fopen($filename,"r"
$struser = explode("[USER=",fread(fop
echo $struser[1];
echo "<br />";
echo $struser[2];
?>
The next step, I guess, would be to get the line "PASSWORD=" and see if it corresponds to the relevant username entered into the form. This is where I loose it ;P, any help would be GREATLY appreciated!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks VERY much, I dont think i'd have ever got that by myself!
$struser = explode("\n", $handle);
fclose($handle);
try something like this