After much distress, I finally got it to work.... It opens the file atleast....
I had to modify the function and make the variable $data_file a global variable, and then it worked fine. The function looks like this now:
function VerifyPwd($user,$password) {
global $data_file;
$found=false;
$ret = array();
$pwdcrypted=md5($password);
if (($fileopen = file($data_file)) == false) {
echo "File Open Error: Unable to read file $data_file";
}
while (list($linenum, $line) = each($fileopen) && !$found) {
$line=trim($line);
if(!preg_match("{^#}",$line) && $line!="") {
$array=explode("|",$line);
if($array[0]==$l && $array[1]==$pwdcrypted) {
$ret["AUTH"]=1;
$ret["USER"]=$user;
$ret["HOME"]=$array[2];
$found=true;
}
}
}
if(!$found) {
$ret["AUTH"]=0;
$ret["USER"]=$user;
$ret["HOME"]="";
}
return $ret;
}
and the variable defined in the include file is:
$data_file = "files/data.txt";
the passwords from the file still don't validate...but one step at a time I suppose.