$assPdf = $_COOKIE["assPdfSolution"];
    }
    if (isset($_COOKIE["assNoSolution"])) {
        $assNo = $_COOKIE["assNoSolution"];
    }
    if (isset($_COOKIE["email"])) {
        $email = $_COOKIE["email"];
    }
    if (isset($_COOKIE["id"])) {
        $id = $_COOKIE["id"];
    }
    if ($assId == "-1" || $assCourse == "-1" || $assPdf == "-1" || $assNo == "-1") {
        die("Oops! We encountered an error while submitting your solution. Please go back and try again.");
    } else {
        if (move_uploaded_file($_FILES['fileAssignmentSolution']['tmp_name'], $UploadDirectory . $NewFileName)) {
            // save the link to the database.
            $mentorId = GetMentorIDOfMentee($email, $id);
            // there are 2 cases here. if the $assNo is 1, then insert into the LastSubmittedAssignment table. Otherwise, upate the LastSubmittedAssignment table entry.
            $resp = RegisterSubmission($email, $id, $mentorId, $assId, $UploadDirectory . $NewFileName, $assCourse, $assNo);
            if ($resp == "-1") {
                echo "Oops! We encountered an error while submitting your assignment solution. Please try again.";
            } else {
                echo "Assignment Solution submitted successfully. Thank You.";
            }
        } else {
            die('error uploading File!');
        }
    }
} else {
    die('Something wrong with upload! Is "upload_max_filesize" set correctly?');
}
Ejemplo n.º 2
0
function GetMentorDetailsOfMentee($email, $id)
{
    $resp = "-1";
    $mentor = array();
    $mentorID = "0";
    try {
        $mentorID = GetMentorIDOfMentee($email, $id);
        if ($mentorID == "0") {
            $resp = "-2";
        } else {
            if ($mentorID == "-1") {
                $resp = "-1";
            } else {
                $mentor = GetMentorDetails($mentorID);
                header('Content-Type: application/json');
                $resp = json_encode($mentor);
            }
        }
        echo $resp;
    } catch (Exception $e) {
        $resp = "-1";
        echo $resp;
    }
}