|
Posted by Jerry Stuckle on 02/07/06 12:28
Mike wrote:
> "Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
> news:_cKdnZScBvXoZ3renZ2dnUVZ_s6dnZ2d@comcast.com...
> Mike wrote:
>
>>"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
>>news:jpSdncRvI4QQpHrenZ2dnUVZ_t2dnZ2d@comcast.com...
>>Mike wrote:
>>
>>Ah, I did not catch that since I changed the user records. It puzzled me then I remembered DUH!
>>the
>>organization records. So they are now changed.
>>
>>However, everything still comes back zero. A question I do have is why does the first number
>>(varbinary(8) in MySQL) come back hex but the second number (PHP code as
>>define('CERTACCESS_MEMENTRY', 0x01);) come back as decimal (or so it looks like)? Could that be
>>the
>>problem?
>>
>>
>>function SecurityLevel_Check($security_byte, $securitylevel_bit) {
>>// & = 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_Check
>>
>>nonbin byte=0xFE /bit=2 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0xFE /bit=1 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0xFE /bit=4 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0xFE /bit=8 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0xFE /bit=16 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0xFE /bit=32 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0xFE /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
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x00 /bit=32 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x00 /bit=64 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x6E /bit=4 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x6E /bit=8 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x6E /bit=16 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x6E /bit=32 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x04 /bit=1 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x04 /bit=2 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x04 /bit=4 /nonbin result is 0
>>
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x04 /bit=8 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x04 /bit=16 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x04 /bit=32 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x01 /bit=1 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x01 /bit=2 /nonbin result is 0
>>
>>SecurityLevel_Check
>>
>>nonbin byte=0x01 /bit=4 /nonbin result is 0
>
> >
>
> Mike,
>
> You're still close. But you're still passing a string as the first
> parameter, not a numeric value. Otherwise, printing it out would give
> the value 254 instead of 0xfe.
>
> Bit operations are on integer values only. Here it's taking the '0xfe'
> as a string and converting it to an integer. But the integer value of
> the string is zero - so none of your test work.
>
> You still need to figure out where the strings are coming from. If this
> is coming from a database, the column needs to be an integer type. I
> suspect you have it as a character type column.
>
> BTW, you're doing find with bottom posting. But you need to either post
> before the signature lines or delete them all together. Many news
> readers (like Thunderbird) take everything after the signature separator
> (dash-dash-space on a line by itself) as part of the signature.
>
>
>
> As I said in the message, the database column is varbinary(8) in MySQL. The call to the function is
>
> if(SecurityLevel_Check($recordSet_cert->fields['certcode_access'], CERTACCESS_MEMBERS) == 1) {
>
> Should I change that to
>
> if(SecurityLevel_Check((int)$recordSet_cert->fields['certcode_access'], CERTACCESS_MEMBERS) == 1) {
>
> so it becomes an integer? Okay, tried that and it did not work. This also did not work.
>
> function SecurityLevel_Check((int)$security_byte, $securitylevel_bit)
>
> So I went thru the whole database changing varbinary(8) to tinyint. Then I reset the hex values as
> ints. Then I ran the test and it looks good!
>
> Thank you for your patience and help. It is GREATLY appreciated.
>
> Mike
>
>
>
>
>
>
>
No problem, Mike,
Yes, varbinary is a character type - basically the difference between
that and varchar in MySQL is the binary types are case sensitive.
I know it is confusing, but that's how things work!
Glad you got it going.
And BTW - this post was perfect!
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|