compunet2 Posted April 18, 2009 Share Posted April 18, 2009 I'm trying to run the following code in my webpage. The problem is with the html link. What I want to happen is if the "REMOTE_USER" is equal to the values I specify, I want a url and image to appear. Otherwise, I want nothing to appear. Here is what I have so far: <?php $number_three = $_SERVER['REMOTE_USER']; if ( $number_three == "dsmith" or "jdoe") { <a href="http://www.domain.org/members/admin/"><img src="http://www.domain.org/images/admin.jpg" alt="Administration" vspace=2 border=0></a>; } else { echo " "; } ?> Link to comment https://forums.phpfreaks.com/topic/154666-solved-if-then-else-with-web-link/ Share on other sites More sharing options...
premiso Posted April 18, 2009 Share Posted April 18, 2009 Use an array then the in_array function. <?php $number_three = $_SERVER['REMOTE_USER']; $validNames = array("dsmith", "jdoe"); if (in_array($number_three, $validNames)) { echo '<a href="http://www.domain.org/members/admin/"><img src="http://www.domain.org/images/admin.jpg" alt="Administration" vspace=2 border=0></a>'; } ?> Link to comment https://forums.phpfreaks.com/topic/154666-solved-if-then-else-with-web-link/#findComment-813328 Share on other sites More sharing options...
compunet2 Posted April 18, 2009 Author Share Posted April 18, 2009 Perfect! Thank you! Link to comment https://forums.phpfreaks.com/topic/154666-solved-if-then-else-with-web-link/#findComment-813330 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.