I've almost got a handy little PHP snippet. The idea is that when a user access this .htpasswd protected page, the user name is checked against a dbman password file. If the REMOTE_USER name is in the file, Instructional Greeting ONE is shown. And if the REMOTE_USER name isn't in the dbman password file, Instructional Greeting TWO is displayed.
So far, I've got the first part working fine. But I can't seem to get the "else" part right.
Here's what's working so far:
$file="/path and file name";
$fd = fopen ($file, "r");
$contents = file($file);
$number = count($contents);
for($i=0;$i<$number;$i++) { if(strstr($contents[$i],$REMOTE_USER)) print ("Instructional Greeting ONE<P>"); }
If anyone can show me how to add an else factor to this..... Thanks.
So far, I've got the first part working fine. But I can't seem to get the "else" part right.
Here's what's working so far:
$file="/path and file name";
$fd = fopen ($file, "r");
$contents = file($file);
$number = count($contents);
for($i=0;$i<$number;$i++) { if(strstr($contents[$i],$REMOTE_USER)) print ("Instructional Greeting ONE<P>"); }
If anyone can show me how to add an else factor to this..... Thanks.