PineSmokes Posted November 23, 2015 Share Posted November 23, 2015 (edited) It seemed to be working at some point but I'm not sure what I did now it displays the Admin Page button forever, I don't want it to include the button if the user admin is on the page. On the top of the admin.php page after the session_start(); I have this: $_SESSION['url']="http://www.golden-wand.com/pages/admin.php"; In the header.php I have this: <?php if($_SESSION['admin']==='1'){ if($_SESSION['url'] != 'http://www.golden-wand.com/Pages/admin.php'){ ?> <input type="button" value="Admin Page" class="button hvr-wobble-skew" onclick="location.href='http://www.golden-wand.com/Pages/admin.php'"> <?php }} ?> It's seems to be skipping the second if statement, I'm probably doing something wrong. I originally was attempting to put the entire input Admin Page button into a variable to be echoed back in my message section but it never worked because the variable seems to mess up the onclick fucntion since it's unable to accept double quotes. Please let me know how to accomplish hiding the button if this page exists Thanks I need this here with every post right? I own this site: http://www.golden-wand.com/phpfreaks.txt just added it to my signature Edited November 23, 2015 by PineSmokes Quote Link to comment https://forums.phpfreaks.com/topic/299564-whats-wrong-with-my-if-not-equal-statement/ Share on other sites More sharing options...
Solution Psycho Posted November 23, 2015 Solution Share Posted November 23, 2015 You only need to include a link to a txt file if you are wanting us to run some specific tests on your site. You do not need it to ask a question about some code. You may have a failure on both conditions: if($_SESSION['admin']==='1'){ The three equal signs means it has to match the value and the type - i.e. it has to be a string value of one. A numeric value of 1 will not pass the condition. On the second condition it will never match because "pages" does not equal "Pages" Quote Link to comment https://forums.phpfreaks.com/topic/299564-whats-wrong-with-my-if-not-equal-statement/#findComment-1527017 Share on other sites More sharing options...
PineSmokes Posted November 24, 2015 Author Share Posted November 24, 2015 Actually the first condition does work perfectly fine and you nailed the second one right on the head, that one seems to work fine but it is nice to know what two and three equal signs mean so thanks for that You only need to include a link to a txt file if you are wanting us to run some specific tests on your site. You do not need it to ask a question about some code. You may have a failure on both conditions: if($_SESSION['admin']==='1'){ The three equal signs means it has to match the value and the type - i.e. it has to be a string value of one. A numeric value of 1 will not pass the condition. On the second condition it will never match because "pages" does not equal "Pages" Quote Link to comment https://forums.phpfreaks.com/topic/299564-whats-wrong-with-my-if-not-equal-statement/#findComment-1527019 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.