$chmod = chmod($user, 0700);
 }
 $user = $media . $logado['id_member'];
 $tmp = $file['tmp_name'];
 $name .= "." . $ext;
 $profile = $user . $ds . 'profile';
 if (!is_dir($profile)) {
     $mkdir = mkdir($profile, 0700);
     $chmod = chmod($profile, 0700);
 }
 $source = $profile . $ds . $name;
 if (move_uploaded_file($tmp, $source)) {
     $sql = array("id_member" => $logado['id_member'], "status" => 1);
     $image = new MemberImage();
     $image->fields = array('id_member_image');
     if ($image->count($sql) == 1) {
         $rs = $image->get($sql);
         $rs = $rs[0];
         echo $source = $logado['id_member'] . $ds . $ds . 'profile' . $ds . $ds . $name;
         $sql = array("src" => $source, "name" => $file['name'], "mime_type" => $file['type']);
         $image = new MemberImage();
         $image->fields = $sql;
         $image = $image->update(array("id_member_image" => $rs['id_member_image']));
         if (count($image) > 0) {
             $image = new MemberImage();
             $image->fields = array('src');
             $rsImage = $image->get($sql);
             if (count($rsImage) > 0 && is_array($rsImage)) {
                 $rs = array_merge($rsImage[0], $logado);
                 Session::update('logado', $rs);
             }