SHARE
TWEET

Untitled

a guest Jun 12th, 2019 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function updateUserSettings()
  2. {
  3.     $request = \Slim\Slim::getInstance()->request();
  4.     $data = json_decode($request->getBody());
  5.     $response['success'] = false;
  6.  
  7.     $userDetails = getUserBySignature();
  8.     $uid = $userDetails->uid;
  9.  
  10.     $user = $request->post('user_data');
  11.     $firstName = $user['first_name'];
  12.     $lastName = $user['last_name'];
  13.     $password = $user['password'];
  14.     $img = $user['profile_pic'];
  15.     $update = array(
  16.         'first_name' => $firstName,
  17.         'last_name' => $lastName,
  18.         'uid' => $uid;
  19.     );
  20.  
  21.     $db = getDB();
  22.  
  23.     $sql="UPDATE users SET first_name = '?', last_name = '?' WHERE uid = ? ";
  24.     $stmt = $db->prepare($sql);
  25.     $stmt->execute(array_values($update));
  26.  
  27. /*
  28.     if (!empty($password) && strlen($password) > 6) {
  29.         $insert['pasword'] = $password;
  30.         $sql.= ', password = ?';
  31.     }
  32.  let me copy a function here
  33.     if (isset($img) && substr_count($img, ',') > 0) {
  34.  
  35.         $save_path = 'uploads/usersPic/';
  36.         $img = md5(time()) . '.jpg';
  37.  
  38.         if (base64_to_jpeg($user['profile_pic'], $save_path . $img)) {//thats wrong
  39.             $insert['profile_pic'] = $img;
  40.             $sql.= ', profile_pic = ?';
  41.         }
  42.     }
  43.     */
  44.  
  45.  
  46.         // Log activity
  47.         $log = array(
  48.             'id_user' => $uid,
  49.             'id_media' => NULL,
  50.             'id_flow' => NULL,
  51.             'description' => ' changed his Settings. ',
  52.             'added_at' => date('Y-m-d H:i:s'),
  53.         );
  54.         logActivity($log);
  55.  
  56.  
  57.         $db = null;
  58.         $response['success'] = true;
  59.         $response['message'] = 'Points saved';
  60.  
  61.         echo json_encode($response);
  62.  
  63. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top