Gossamer Forum
Home : General : Perl Programming :

PHP else problem

Quote Reply
PHP else problem
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.
Subject Author Views Date
Thread PHP else problem averick 6864 Oct 11, 2001, 10:30 PM
Thread Re: [averick] PHP else problem
yogi 6775 Oct 12, 2001, 1:14 AM
Thread Re: [yogi] PHP else problem
averick 6665 Oct 12, 2001, 7:14 AM
Thread Re: [averick] PHP else problem
Paul 6702 Oct 12, 2001, 7:21 AM
Thread Re: [RedRum] PHP else problem
Michael_Bray 6659 Oct 12, 2001, 7:46 AM
Thread Re: [Michael_Bray] PHP else problem
averick 6630 Oct 12, 2001, 8:03 AM
Post Re: [averick] PHP else problem
Paul 6630 Oct 12, 2001, 8:55 AM
Thread Re: [Michael_Bray] PHP else problem
Paul 6689 Oct 12, 2001, 8:56 AM
Thread Re: [RedRum] PHP else problem
averick 6652 Oct 12, 2001, 10:01 AM
Thread Re: [averick] PHP else problem
Paul 6731 Oct 12, 2001, 10:03 AM
Thread Re: [RedRum] PHP else problem
averick 6645 Oct 12, 2001, 2:46 PM
Post Re: [averick] PHP else problem
Michael_Bray 6617 Oct 12, 2001, 7:10 PM