. */ function ListBlocks() { global $db; $result = $db->Query("SELECT * FROM `bayonet_blocks` ORDER BY `position`, `active` DESC, `weight` ASC"); $blocks = $db->Fetch($result); echo ""; echo ""; foreach($blocks as $block) { echo ""; } echo "
Existing Blocks
WeightPositionNameActive
{$block['weight']}"; if($block['position']) echo "Right"; else echo "Left"; echo "{$block['title']}{$block['active']}EditDelete
"; } function NewBlock() { global $db; if(isset($_POST['processed'])) { //Secure our data to prevent injection attacks. $weight = addslashes($_POST['weight']); $dir_name = addslashes($_POST['dir_name']); $position = addslashes($_POST['position']); $active = addslashes($_POST['active']); $title = addslashes($_POST['title']); if(!is_int($weight) || empty($dir_name) || empty($title) || !is_int($position)) { echo "You must fill everything out before proceeding."; return; } //Update the database with the new data. $db->Query("INSERT INTO `bayonet_blocks` SET `weight` = '$weight', `dir_name` = '$dir_name', `title` = '$title', `position` = '$position', `active` = '$active'"); //die, because we have completed what we wanted to do. echo "New block, '$dir_name', at position '$weight' added.\n"; return; } ?> You are currently adding a new block

Title
Weight
Position
Directory Name
Active
', "?op=blocks"); ?>
'Yes',0 => 'No'); foreach($options as $option => $value) { $selected = NULL; if($active == $option) { $selected = "selected"; } echo "\n"; } } function EditBlock($block_id) { global $db; if(isset($_POST['processed'])) { //Secure our data to prevent injection attacks. $weight = (int) addslashes($_POST['weight']); $dir_name = addslashes($_POST['dir_name']); $position = (int) addslashes($_POST['position']); $active = addslashes($_POST['active']); $title = addslashes($_POST['title']); if(!is_int($weight) || empty($dir_name) || empty($title) || !is_int($position)) { echo "You must fill everything out before proceeding."; return; } //Update the database with the new data. $db->Query("UPDATE bayonet_blocks SET title = '$title', weight = '$weight', dir_name = '$dir_name', position = '$position', active = '$active' WHERE block_id = '$block_id'"); //$isActive = $active ? "IS" : "IS NOT"; echo "Block, '$dir_name', at position '$weight'(order) has been edited.\n"; PageRedirect(3, "?op=blocks"); //die, because we have completed what we wanted to do. return; } //Grab the page from the database according to the $page_id passed to the function. $result = $db->Query("SELECT weight,dir_name,position,active,title FROM bayonet_blocks WHERE block_id = '$block_id'"); $block = $db->FetchRow($result); ?> You are currently editing the '' block

Title
Weight
Position
Directory Name
Active
', "?op=blocks"); ?>
Query("SELECT dir_name FROM bayonet_blocks WHERE block_id = '$block_id'"); $block = $db->Fetch($result); if(isset($_POST['proceed'])) { echo "Block '{$block['dir_name']}', was deleted."; $db->Query("DELETE FROM bayonet_blocks WHERE block_id = '$block_id' LIMIT 1"); return; } if(isset($_POST['cancel'])) { echo "User cancelled deletion of page: '{$block['dir_name']}'"; return; } ?>
Are you SURE you want to delete the block titled: ''?
   
"; if(!$value){ echo ""; echo ""; }else{ echo ""; echo ""; } echo ""; } ?>