Here is a function from Dreamweaver, if (($strUsers == "") && false) what the false is referring to? in what case it is a TRUE, and in what case it is a FALSE ? Thank you.
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && false) {
$isValid = true;
}
}
return $isValid;
}
Quoting from a forum:
Likewise the following line of code: if (($strUsers == "") && false) { contains true or false accordingly and this is what actually controls whether user has access or not. So, if I am right then the 'false' in the above satement could be replaced with the variable $MM_donotCheckaccess - this would make the code easier to read and make use of the variable. Otherwise it seems to be entirely redundant!
Also, this makes this block NEVER run. It seems if you set to true, a blank user can login or anyone can login if there's no user, I don't know what does it actually stand for, but from the name one of the mentioned 2 possibilities.
Looks like an error to me. Because of that false, that if statement will always be false, so $isValid = true;
should never get executed. You should recheck the logic that you are trying to accomplish with this code, because it seems confusing at best, and simple incorrect at worst.
I've seen that done as a means of temporarily disabling a check (usually for testing / debugging purposes). It was probably left in. I'm not saying that's a good idea just that seems why you'd come across code like that.
It's used by Dreamweaver as something that it can easily replace depending on the settings you specify when you initially go through Dreamweaver's setup - it will place either true
or false
there depending on whether or not you told it to actually check access.
False referring nothing, you want only below condition for checking.
if ($strUsers == "")