Пример #1
0
function Submit(&$arg)
{
    $pid = safefetch($arg, 'pid');
    $cid = safefetch($arg, 'cid');
    $lang = safefetch($arg, 'language');
    $source = isset($arg['source']) ? $arg['source'] : '';
    $ret = submit_source($pid, $cid, $lang, $source);
    if (is_numeric($ret)) {
        Output("status", "success");
        Output("sid", $ret);
    } else {
        Fail($ret);
    }
}
Пример #2
0
function StdSubmit(&$arg)
{
    $pid = safefetch($arg, 'pid');
    $source = isset($arg['source']) ? $arg['source'] : '';
    $language = safefetch($arg, 'language');
    $cid = 0;
    $ret = submit_source($pid, $cid, $language, $source);
    if (is_numeric($ret)) {
        // success
        $sid = intval($ret);
        $problem = new ProblemTbl($pid);
        $problem->Get();
        $problem->update['stdsid'] = $sid;
        $problem->Update();
        MsgAndRedirect('stdprogram.php?pid=' . $pid);
    } else {
        MsgAndRedirect('stdprogram.php?pid=' . $pid, $ret);
    }
}