Ejemplo n.º 1
0
#
#
#
#
#
#
#
#
# get settings
require "../settings.php";
$OUTPUT = "<li class='err'>Disabled</li>";
require "../template.php";
exit;
# decide what to do
if (isset($_GET["id"])) {
    $OUTPUT = confirmDeduct($_GET["id"]);
} elseif (isset($_POST["key"])) {
    $OUTPUT = $_POST["key"] == "rem" ? remDeduct($_POST["id"]) : "Invalid use of module.";
} else {
    $OUTPUT = "Invalid use of module.";
}
# display output
require "../template.php";
# confirm new data
function confirmDeduct($id)
{
    # validate input
    require_lib("validate");
    $v = new validate();
    $v->isOk($id, "num", 1, 20, "Invalid deduction id.");
    # display errors, if any
#
#
# get settings
require "../settings.php";
require "../core-settings.php";
# decide what to do
if (isset($_POST["key"])) {
    switch ($_POST["key"]) {
        case "confirm":
            $OUTPUT = confirmDeduct($_POST);
            break;
        case "write":
            if (isset($_REQUEST["submit_ded"])) {
                $OUTPUT = writeDeduct($_POST);
            } else {
                $OUTPUT = confirmDeduct($_POST);
            }
            break;
        default:
            $OUTPUT = enterDeduct($_POST["refno"]);
    }
} else {
    $OUTPUT = enterDeduct($_GET["refno"]);
}
# display output
require "../template.php";
# enter new data
function enterDeduct($refno)
{
    # validate input
    require_lib("validate");