Ejemplo n.º 1
0
         break;
     }
     $password_update_result = password_update($old_password, $password);
     if ($password_update_result == false) {
         redirect('../error.php');
     }
     echo $password_update_result;
     break;
 case "upload":
     //Check If file or Post
     if (!$_FILES['user_image']) {
         if ($_POST['user_image'] == 'def_img') {
             $def_img = $_POST['user_image'];
             $def_img = addslashes($def_img);
             $def_img = strip_tags($def_img);
             echo write_user_image_to_db($def_img);
             break;
         }
     }
     if ($_FILES['user_image']['size'] == 0) {
         redirect('../error.php');
         break;
     } else {
         if (substr($_FILES['user_image']['type'], 0, 5) != "image") {
             redirect('../error.php');
             break;
         } else {
             $uploudedPicture = $_FILES['user_image'];
             createUserPicture($uploudedPicture);
         }
     }
Ejemplo n.º 2
0
function createUserPicture($userPicture)
{
    $user_picture_name = md5($_SESSION['uuID']);
    $userPicture = new Upload($_FILES['user_image']);
    if ($userPicture->uploaded) {
        $userPicture->file_new_name_body = $user_picture_name;
        $userPicture->image_resize = true;
        $userPicture->image_x = 600;
        $userPicture->image_ratio_y = true;
        $userPicture->file_overwrite = true;
        $userPicture->image_convert = 'png';
        // save uploaded image with no changes
        $userPicture->Process('../profileImg');
        if ($userPicture->processed) {
            write_user_image_to_db();
        } else {
            echo 'error : ';
        }
    }
}