NOT operator (!) doesn't seem to be working...
Posted: Fri Jul 25, 2008 2:18 pm
Basically, the NOT (!) operator in my PHP code does not seem to be working...
This is a continuation from my other post "Why isn't this code working", but it seems that I have narrowed down the problem to the not operator.
Rather than reiterate it all here, please just go to that topic and check it out. It really should work and I can't figure out why it doesn't.
Right now I temporarily have the code:
This works, but I shouldn't have to use it and it won't allow me to only let a specific user and an admin view it, because for that to be efficient, I'd need:
Otherwise, I'd have to list all other users (not gonna happen!).
So if you could read that topic and see any possible reasons why it doesn't work, or at the least an equally convenient way of achieving the second piece of code without using a !, put 'er 'ere!
This is a continuation from my other post "Why isn't this code working", but it seems that I have narrowed down the problem to the not operator.
Rather than reiterate it all here, please just go to that topic and check it out. It really should work and I can't figure out why it doesn't.
Right now I temporarily have the code:
Code: Select all
<?php
if ( $_SESSION['verified'] == "" ) {
header ("Location:http://www.mydomain.com/no_access.html");
// I have also used exit; here, but that didn't help either
}
?>Code: Select all
<?php
if ((!$_SESSION['user_name'] == "Bob") || (!$_SESSION['user_name'] == "Admin")){
header ("Location:$_SESSION[redirect]"); // A predefined complete URL, client-specific
}
?>So if you could read that topic and see any possible reasons why it doesn't work, or at the least an equally convenient way of achieving the second piece of code without using a !, put 'er 'ere!