payney Posted October 5, 2007 Share Posted October 5, 2007 Hi all. I am using this feature, so i can conditonally display stuff. Now, how do I set the result of the following to a variable so I can just use that, currently, I am doing it like the following: <?php if ((!isset($_SERVER['PHP_AUTH_USER'])) || ( !isset($_SERVER['PHP_AUTH_PW'])) ||($_SERVER['PHP_AUTH_USER'] != 'username) || ($_SERVER['PHP_AUTH_PW'] != 'passy' )); else { ?> SHOW RED <?php } ?> Link to comment https://forums.phpfreaks.com/topic/71965-solved-setting-logged-in-to-a-variable/ Share on other sites More sharing options...
Psycho Posted October 5, 2007 Share Posted October 5, 2007 <?php if ( !isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW']) || ($_SERVER['PHP_AUTH_USER'] != 'username) || ($_SERVER['PHP_AUTH_PW'] != 'passy' )) { $logged_in = false; } else { $logged_in = true; } ?> Link to comment https://forums.phpfreaks.com/topic/71965-solved-setting-logged-in-to-a-variable/#findComment-362483 Share on other sites More sharing options...
payney Posted October 5, 2007 Author Share Posted October 5, 2007 Would I then do: <?php if ($admin_in = true) { ?> <!-- Conditionally display the admin looged in and the HR--> <div align="center" class="admin_mode">ADMIN LOGGED IN </div> <hr color="red"> <?php } ?> Because that dosnt work for me Link to comment https://forums.phpfreaks.com/topic/71965-solved-setting-logged-in-to-a-variable/#findComment-362492 Share on other sites More sharing options...
payney Posted October 5, 2007 Author Share Posted October 5, 2007 Whoops, its == not = isnt it? Haha. Thanks all, great forums and members! Link to comment https://forums.phpfreaks.com/topic/71965-solved-setting-logged-in-to-a-variable/#findComment-362495 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.