So I've got a page in a htpasswd protected directory. When the user accesses the page, I want to query a text file to see if their name is in there. If it is, I want to print an instructional greeting.
Here's what I've got so far, but it's not working.... The problem is with USERNAME. I need that to change each time -- to reflect the name they logged in with -- that would be REMOTE_USER. But I can't seem to get the syntax right. If I replace user name with the actual static name of a user -- like USER11, it works fine.
$file="/path and name of file";
$fd = fopen ($file, "r");
$contents = file($file);
$number = count($contents);
for($i=0;$i<$number;$i++) { if(strstr($contents[$i],'USERNAME')) print ("<B>Instructional Greeting</B>"); }
Any ideas?
Thanks,
averick