Пример #1
0
                echo 'Question Added';
            } else {
                echo 'There was an error';
            }
        }
    }
}
if ($_POST['FRQuestion']) {
    $Question = new Questions();
    $input = htmlspecialchars($_POST['inputquest']);
    $usID = $user->data['user_id'];
    if (strlen($_FILES['userfile']['name']) > 1) {
        $file = new files();
        $imageLocation = $file->upload($_FILES['userfile']['name'], $_FILES['userfile']['size'], $_FILES['userfile']['tmp_name'], $_FILES['userfile']['type']);
        // add_question($eventId,    $question,   $a,  $b,   $c, $d, $e,  $correct,$image,  $type, $keywords,   $userID)
        if ($Question->add_question($_POST['event'], $input, NULL, NULL, NULL, NULL, NULL, NULL, $imageLocation, 4, $_POST['keywords'], $usID)) {
            echo 'Question Added';
        } else {
            echo 'There was an error';
        }
    } else {
        if (strlen($_POST['URL']) > 1) {
            $file = new files();
            $imageLocation = $file->pull_image($_POST['URL']);
            // add_question($eventId,$question,        $a,  $b,   $c, $d, $e,  $correct,$image,  $type, $keywords,   $userID)
            if ($Question->add_question($_POST['event'], $input, NULL, NULL, NULL, NULL, NULL, NULL, $imageLocation, 4, $_POST['keywords'], $usID)) {
                echo 'Question Added';
            } else {
                echo 'There was an error';
            }
        } else {