Ejemplo n.º 1
0
    }
}
// do this when invoked by javascript
// types of requests: create_user, update_user, delete_user
const CREATE_USER = "******";
const UPDATE_USER = "******";
const DELETE_USER = "******";
$html_data = null;
if (array_key_exists(CREATE_USER, $_GET)) {
    $html_data = json_decode($_GET[CREATE_USER]);
    if ($html_data != null) {
        $user_profile = new UserProfile();
        $user_profile->createUser($html_data->user_email, $html_data->first_name, $html_data->last_name, $html_data->password, $html_data->linkedin_url, $html_data->skills, $html_data->occupation, $html_data->gender, $html_data->profile_img, $html_data->objective);
    }
} else {
    if (array_key_exists(UPDATE_USER, $_GET)) {
        $html_data = json_decode($_GET[UPDATE_USER]);
        if ($html_data != null) {
            $user_profile = new UserProfile();
            $user_profile->updateUser($html_data->user_email, $html_data->first_name, $html_data->last_name, $html_data->password, $html_data->linkedin_url, $html_data->skills, $html_data->occupation, $html_data->gender, $html_data->profile_img, $html_data->objective);
        }
    } else {
        if (array_key_exists(DELETE_USER, $_GET)) {
            $html_data = json_decode($_GET[DELETE_USER]);
            if ($html_data != null) {
                $user_profile = new UserProfile();
                $user_profile->deleteUser($html_data->user_email);
            }
        }
    }
}