PDA

View Full Version : XML Bitfield help please


Dragon_IBA
10-25-2006, 12:21 AM
I need to be able to interpret the bitfield code in the options field of the user table (vbulleting 3.6.0) I use this table to update another database for a sql/asp program we wrote to track tournamnet points. We also now do html mail outs from this program and i need to be able to extract each users choice on receive admin email (yes or no) from the bitfields. Can anyone help me please?

Paul M
10-25-2006, 12:51 AM
From the vb bitfields list you can see that the adminemail option value is 16 ;

<group name="useroptions">
<bitfield name="showsignatures">1</bitfield>
<bitfield name="showavatars">2</bitfield>
<bitfield name="showimages">4</bitfield>
<bitfield name="coppauser">8</bitfield>
<bitfield name="adminemail">16</bitfield>
<bitfield name="showvcard">32</bitfield>
<bitfield name="dstauto">64</bitfield>
<bitfield name="dstonoff">128</bitfield>
<bitfield name="showemail">256</bitfield>
<bitfield name="invisible">512</bitfield>

So you need to do a logical AND of the useroptions value and 16 - and test the result.

Dragon_IBA
10-25-2006, 01:20 AM
so basically i will need to run a decimal to binary conversion on the options field for every user, then do a logic check in our .net program that checks that ***~**1***** is set.

Paul M
10-25-2006, 02:37 AM
Well in php it would be this, not sure about .net


if ($useroptionsvalue & 16)
{
// option is set.
}


BTW, 16 = bit 5, not bit 6 as in your post.