Пример #1
0
    if ($update === false) {
        $success_msg = "No changes given.";
        goto GenerateHtml;
    }
    // Looks like we are okay to update database!
    $newdata = array();
    foreach ($param_list as $param_spec) {
        $n = $param_spec["FieldName"];
        $v = $param_spec["Value"];
        if ($n == "LastDay") {
            $r = strtotime($v);
            if ($r === false) {
                $error_msg = "Undecodeable time value, try again.";
                goto GenerateHtml;
            }
            $v = date("Y-m-d", $r);
        }
        $newdata[$n] = $v;
    }
    SavePrefsForUser(0, $newdata);
    $data = GetPrefsForUser(0);
    PopulateParamList($param_list, $data);
    $success_msg = "Data Updated!";
    goto GenerateHtml;
}
GenerateHtml:
include "forms/header.php";
include "forms/navform.php";
include "forms/attendance_menubar.php";
include "forms/attendance_setup_form.php";
include "forms/footer.php";
Пример #2
0
function SavePref($PrefName, $PrefValue)
{
    if (!IsLoggedIn()) {
        DieWithMsg("userlib.php->SavePref", "Call to SavePref while not logged in.");
    }
    if (!isset($_SESSION["Prefs"])) {
        DieWithMsg("userlib.php->SavePref", '$_SESSION["Prefs"] Not set!');
    }
    $_SESSION["Prefs"][$PrefName] = $PrefValue;
    SavePrefsForUser(GetUserID(), $_SESSION["Prefs"]);
}