You are here: Re: Problem with AND & « PHP Programming Language « IT news, forums, messages
Re: Problem with AND &

Posted by Jerry Stuckle on 02/07/06 03:40

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.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация