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 } ?> Quote 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; } ?> Quote 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 Quote 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! Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.