Beispiel #1
0
        var_dump($iscorrect);*/
    $db = new DbHandler();
    $res = $db->submitAnswer($input);
    if ($res == 0) {
        $response = array("error" => false, "message" => "successful insert");
        echoResponse(201, $response);
    } else {
        if ($res == 1) {
            $response = array("error" => true, "message" => "failed to insert user response");
            echoResponse(200, $response);
        }
    }
});
$app->get('/lumitrivia/usersubmit/:username', function ($username) use($app) {
    $db = new DbHandler();
    $res = $db->getSubmissionsByUsername($username);
    if ($res == 1) {
        $response = array("error" => true, "message" => "failed getting user submissions");
        echoResponse(201, $response);
    } else {
        echoResponse(200, $res);
    }
});
/**
 * Verifying required params posted or not
 */
function verifyRequiredParams($required_fields)
{
    $error = false;
    $error_fields = "";
    $request_params = array();