$maxlength) $maxlength = strlen($a["description"]); return $maxlength; } function add_account($desc) { global $acc; if (strlen($desc) == 0) return false; $id = ""; if (count($acc)) foreach ($acc as $a) if ($a["id"] > $id) $id = $a["id"]; $acc[] = array("id" => ++$id, "description" => $desc); return store_account($id); } function modify_account($id, $desc) { global $acc; if (strlen($desc) == 0) return false; if (count($acc)) foreach ($acc as $key => $a) if ($a["id"] == $id) { $acc[$key]["description"] = $desc; return store_account($id); } return false; } function delete_account($id) { global $acc; global $trans; /* check consistance before account deletion */ if (count($trans)) { $t_id = array(); foreach ($trans as $key => $t) if ($t["accid"] == $id) { unset($trans[$key]); $t_id[] = $t["id"]; } if (count($t_id)) store_transaction($t_id); } if (count($acc)) foreach ($acc as $key => $a) if ($a["id"] == $id) { unset($acc[$key]); return store_account($id); } return false; } /* Initialization */ include($lib_dir.$db_type."/account.php"); ?>