adding extra bitfields is easy isn't it? its always seemed that way to me... just multiply the last number in it by 2 not hard to write some dynamic code modifications to deal with that...
let me throw some code together... and work this out.
PHP Code:
<?php
include("includes/init.php");
foreach ($_BITFIELD AS $KEY => $VALUE) {
echo "<b>" . $KEY . "</b><br>";
foreach ($VALUE AS $L1KEY => $L1VALUE) {
if (!is_array($L1VALUE)) {
echo "--" .$L1KEY . "=>" . $L1VALUE ."<br>";
} else {
echo "<b>--" . $L1KEY . "</b><br>";
foreach ($L1VALUE AS $L2KEY => $L2VALUE) {
echo "----" .$L2KEY . "=>" . $L2VALUE ."<br>";
}
}
}
}
?>
the above makes the bitfield echo out quite nicely so you can see whats allready there. step 2 is to create something to dynamically create the code to add and where to add it. be back in 20mins or so
PHP Code:
<?php
include("includes/init.php");
$addto = "adminpermissions";
$addwhat = "candoanything";
//create new bit field
foreach ($_BITFIELD AS $KEY => $VALUE) {
if($KEY != $addto) {
foreach ($VALUE AS $L1KEY => $L1VALUE) {
if($L1KEY != $addto) {
continue;
} else {
echo "<pre>\$_BITFIELD['" . $KEY . "']['" . $L1KEY . "'] = array(<br>";
foreach ($L1VALUE AS $L2KEY => $L2VALUE) {
echo " '" . $L2KEY . "' => " . $L2VALUE . ",<br>";
$lastvalue = $L2VALUE;
}
$newvalue = $lastvalue * 2;
echo " '" . $addwhat . "' => " . $newvalue . "<br>);";
}
}
} else {
echo "<pre>\$_BITFIELD['" . $KEY . "'] = array(<br>";
foreach ($VALUE AS $L1KEY => $L1VALUE) {
echo " '" . $L1KEY . "' => " . $L1VALUE . ",<br>";
$lastvalue = $L1VALUE;
}
$newvalue = $lastvalue * 2;
echo " '" . $addwhat . "' => " . $newvalue . "<br>);";
}
}
?>
not 100% complete but you get the idea... its not hard to do.