//Add the meta $response['meta'] = $meta; //Ensure the user is logged in session_start(); if(!isset($_SESSION['userID'])) { //Send the response $response['data']['reason'] = "The user is not logged in."; sendResponse(400, json_encode($response)); return false; } //Get the current user $User = new User($_SESSION['userID']); $password = $_POST['password']; $original_email =$_POST['original_email']; $new_email = $_POST['new_email']; $confirm_new_email = $_POST['confirm_new_email']; $change_email_response = $User -> change_email($password, $original_email, $new_email, $confirm_new_email); //Set the status to 1 (success) $response['meta']['status'] = (int)$change_email_response[0]['status']; //Send the response sendResponse(200, json_encode($response)); return true; ?>