|
Posted by Jerry Stuckle on 02/06/06 13:56
Mike wrote:
> Okay, start from scratch.
>
>
> Define code
>
> define('CERTACCESS_MEMENTRY', 0x01);
>
>
> Function
>
> function SecurityLevel_Check($security_byte, $securitylevel_bit) {
> //AND = 1 IF BOTH are 1
> echo "<P>SecurityLevel_Check";
> $binanswer = $security_byte & $securitylevel_bit;
> echo "<P>nonbin byte=".$security_byte." /bit=".$securitylevel_bit." /nonbin result is ".$binanswer;
> return $security_byte & $securitylevel_bit; }
>
>
> $securitylevel_bit is the defines like the one above. The $security_byte is the data in the database
> record for a person.
>
>
> Output is
> SecurityLevel_Check
>
> nonbin byte=xFE /bit=2 /nonbin result is 0
>
> SecurityLevel_Check
>
> nonbin byte=xFE /bit=1 /nonbin result is 0
>
> SecurityLevel_Check
>
> nonbin byte=xFE /bit=4 /nonbin result is 0
>
> SecurityLevel_Check
>
> nonbin byte=xFE /bit=8 /nonbin result is 0
>
> SecurityLevel_Check
>
> nonbin byte=xFE /bit=16 /nonbin result is 0
>
> SecurityLevel_Check
>
> nonbin byte=xFE /bit=32 /nonbin result is 0
>
> SecurityLevel_Check
>
> nonbin byte=xFE /bit=128 /nonbin result is 0
>
> SecurityLevel_Check
>
> nonbin byte=0x00 /bit=1 /nonbin result is 0
>
> SecurityLevel_Check
>
> nonbin byte=0x00 /bit=2 /nonbin result is 0
>
> SecurityLevel_Check
>
> nonbin byte=0x00 /bit=4 /nonbin result is 0
>
> SecurityLevel_Check
>
> nonbin byte=0x00 /bit=8 /nonbin result is 0
>
> SecurityLevel_Check
>
> nonbin byte=0x00 /bit=16 /nonbin result is 0
>
>
Mike,
You're getting closer - but you're still passing the STRING "xFE" as the
first parameter, not a HEX value. When converted to a number for the
bit operations, the string will be converted to zero.
You need to pass a numeric value to the function.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|