Esempio n. 1
0
require_once 'classes/day.php';
//get headers
$headers = getallheaders();
//validate parameter and headers
if (isset($_GET['id']) & isset($headers['email']) & isset($headers['token'])) {
    //validate
    if ($headers['token'] == generate_token($headers['email'])) {
        try {
            //start json
            $c = new Child($_GET['id']);
            $json = '{ "status" : 0, "childs" : [';
            $json .= '{ "id" : "' . $c->get_id() . '",
                               "photo" : "' . $c->get_photo() . '",
                               "firstname" : "' . $c->get_first_name() . '",
                               "lastname" : "' . $c->get_last_name() . '",
                               "dateofbirth" : "' . $c->get_date_of_birth() . '",
                               "skills" : "' . $c->get_skills() . '",
                               "status" : "' . $c->get_status() . '",';
            $id = $c->get_tutor();
            $tutor = new Person($id);
            $json .= '
                               "tutor" : {
                                        "id" : "' . $tutor->get_id() . '",
                                        "role" : "' . $tutor->get_role() . '",
                                        "photo" : "' . $tutor->get_photo() . '",
                                        "firstname" : "' . $tutor->get_first_name() . '",
                                        "lastname" : "' . $tutor->get_last_name() . '",
                                        "date_of_birth" : "' . $tutor->get_date_of_birth() . '",
                                        "email" : "' . $tutor->get_email() . '",
                                        "phone" : "' . $tutor->get_phone() . '",
                                        "address" : "' . $tutor->get_address() . '"