GetReady Posted April 26, 2010 Share Posted April 26, 2010 Hey, basically this code below SHOULD hide the admin panel from non admins (any level other than 1) active is the level... Now the code is somewhat working as its hiding the code... but from the admins as well is there an error in this particular code im missing or do i need to dig deeper, any help will be appreciated, Thanks. <? if ($usT->active==1) { ?> <form method="POST"> <input type="radio" name="all"> Reset Round<BR><BR> <input type="submit" name="reset" value="Reset Round!"> </form> <? }else{ echo "You are not allowed to view this page!"; } ?> Link to comment https://forums.phpfreaks.com/topic/199757-hey-anyone-have-a-clue-here/ Share on other sites More sharing options...
de.monkeyz Posted April 26, 2010 Share Posted April 26, 2010 The code seems fine, the problem however is most likely the value inside of $usT->active. Before the if, echo it's value to check it. Link to comment https://forums.phpfreaks.com/topic/199757-hey-anyone-have-a-clue-here/#findComment-1048466 Share on other sites More sharing options...
developerdave Posted April 26, 2010 Share Posted April 26, 2010 Your if statement may be trying to do a string comparison, try putting ' around the 1 like below <?php if ($usT->active=='1') { ?> <form method="POST"> <input type="radio" name="all"> Reset Round<BR><BR> <input type="submit" name="reset" value="Reset Round!"> </form> <?php }else{ echo 'You are not allowed to view this page!'; } ?> I'd also try and use long php tags (<?php ?>) been struck down many a time by that! Also just another little tip, using double quotation marks will tell PHP to look for a variable within that string, if you don't have one thats a millisecond you just lost for nothing Link to comment https://forums.phpfreaks.com/topic/199757-hey-anyone-have-a-clue-here/#findComment-1048507 Share on other sites More sharing options...
de.monkeyz Posted April 26, 2010 Share Posted April 26, 2010 @DeveloperDave PHP won't be checking type in the comparison, since he is using == not === Link to comment https://forums.phpfreaks.com/topic/199757-hey-anyone-have-a-clue-here/#findComment-1048518 Share on other sites More sharing options...
developerdave Posted April 26, 2010 Share Posted April 26, 2010 Hence 'may be', Its something I've had many hours of pulling my hair out over so its worth checking/trying. Link to comment https://forums.phpfreaks.com/topic/199757-hey-anyone-have-a-clue-here/#findComment-1048524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.