Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function updateUserSettings()
- {
- $request = \Slim\Slim::getInstance()->request();
- $data = json_decode($request->getBody());
- $response['success'] = false;
- $userDetails = getUserBySignature();
- $uid = $userDetails->uid;
- $user = $request->post('user_data');
- $firstName = $user['first_name'];
- $lastName = $user['last_name'];
- $password = $user['password'];
- $img = $user['profile_pic'];
- $update = array(
- 'first_name' => $firstName,
- 'last_name' => $lastName,
- 'uid' => $uid;
- );
- $db = getDB();
- $sql="UPDATE users SET first_name = '?', last_name = '?' WHERE uid = ? ";
- $stmt = $db->prepare($sql);
- $stmt->execute(array_values($update));
- /*
- if (!empty($password) && strlen($password) > 6) {
- $insert['pasword'] = $password;
- $sql.= ', password = ?';
- }
- let me copy a function here
- if (isset($img) && substr_count($img, ',') > 0) {
- $save_path = 'uploads/usersPic/';
- $img = md5(time()) . '.jpg';
- if (base64_to_jpeg($user['profile_pic'], $save_path . $img)) {//thats wrong
- $insert['profile_pic'] = $img;
- $sql.= ', profile_pic = ?';
- }
- }
- */
- // Log activity
- $log = array(
- 'id_user' => $uid,
- 'id_media' => NULL,
- 'id_flow' => NULL,
- 'description' => ' changed his Settings. ',
- 'added_at' => date('Y-m-d H:i:s'),
- );
- logActivity($log);
- $db = null;
- $response['success'] = true;
- $response['message'] = 'Points saved';
- echo json_encode($response);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement