Пример #1
0
$isactive = $_POST['isactive'];
$o->isAdmin = $xoopsUser->isAdmin();
$o->createdby = $xoopsUser->getVar('uid');
$o->updatedby = $xoopsUser->getVar('uid');
if ($isactive == "Y" or $isactive == "on") {
    $o->isactive = 'Y';
} else {
    $o->isactive = 'N';
}
switch ($action) {
    case "create":
        // if the token is exist and not yet expired
        $log->showLog(4, "Accessing create record event, with races name={$o->races_name}");
        if ($s->check(true, $token, "CREATE_RCE")) {
            if ($o->insertRaces()) {
                $latest_id = $o->getLatestRacesID();
                redirect_header("races.php", $pausetime, "Your data is saved, the new id={$latest_id}. Redirect to create new races.");
            } else {
                $log->showLog(1, "Can't create races '{$o->races_name}', please verified your data!");
                $token = $s->createToken($tokenlife, "CREATE_RCE");
                $o->getInputForm("new", -1, $token);
                $o->showRacesTable();
            }
        } else {
            // if the token is not valid or the token is expired, it back to previous form with previous inputed data
            $log->showLog(1, "Can't create races '{$o->races_name}' due to token expired!");
            $token = $s->createToken($tokenlife, "CREATE_RCE");
            $o->getInputForm("new", -1, $token);
            $o->showRacesTable();
        }
        break;