Ejemplo n.º 1
0
} else {
    if (isset($_GET['tag']) && $_GET['tag'] != '') {
        require_once 'DbStudent.php';
        $db = new DbStudent();
        $tag = $_GET['tag'];
        $res = array("tag" => $tag, "error" => FALSE);
        if ($tag == "student") {
            $student_no = $_GET['student_no'];
            $email = $_GET['email'];
            $password = $_GET['password'];
            $device_id = $_GET['reg_id'];
            $course = $_GET['course'];
            $status = $_GET['status'];
            $res = $db->addStudent($student_no, $email, $password, $device_id, $course, $status);
            if ($res != false) {
                if ($db->addDevices($student_no, $device_id)) {
                }
                $stat = $db->updateStatus($student_no, $status);
                if ($stat) {
                    $res["error"] = FALSE;
                    $res["error_msg"] = "Student status updated";
                    echo json_encode($res);
                } else {
                    $res["error"] = TRUE;
                    $res["error_msg"] = "Student status Not updated";
                    echo json_encode($res);
                }
            } else {
                $res = $db->getStudent($student_no, $password);
                if ($res != false) {
                    if ($db->addDevices($student_no, $device_id)) {