예제 #1
0
파일: process.php 프로젝트: thezawad/Sicily
function CreateContest(&$arg)
{
    $contest = new ContestsTbl();
    $contest->detail = $arg;
    global $login_uid;
    $contest->detail['owner'] = $login_uid;
    if (trim($arg['title']) == "") {
        error("Contest title can't be null");
    }
    $course_id = tryfetch($arg, 'course_id', "");
    if ($contest->Add()) {
        if ($course_id) {
            MsgAndRedirect("course_detail.php?course_id={$course_id}");
        } else {
            MsgAndRedirect("contests.php");
        }
    } else {
        MsgAndBack("Can't create contest");
    }
}