function oos_copy_uploaded_file($filename, $target)
{
    if (substr($target, -1) != '/') {
        $target .= '/';
    }
    if (OOS_RANDOM_PICTURE_NAME == '1') {
        $picture_tempname = oos_get_random_picture_name(26);
        $picture_tempname .= '.';
        $picture_tempname .= oos_get_extension($filename['name']);
    } else {
        $picture_tempname = $filename['name'];
    }
    $picture_name = oos_str_strip_all($picture_tempname);
    // Big Image
    // path for big image:
    $target_big = $target . OOS_POPUP_IMAGES;
    // If !path make it, if you have problems remove the line
    // if (!is_dir($target_big)) mkdir($target_big,0777);
    // Resize Big image
    $target_big .= $picture_name;
    if (OOS_WATERMARK == '1') {
        oos_watermark($filename['tmp_name'], $target_big, OOS_WATERMARK_QUALITY);
    } else {
        if (OOS_BIGIMAGE_WIDTH || OOS_BIGIMAGE_HEIGHT) {
            oos_resize_image($filename['tmp_name'], $target_big, OOS_BIGIMAGE_WIDTH, OOS_BIGIMAGE_HEIGHT, OOS_BIGIMAGE_WAY_OF_RESIZE);
        } else {
            copy($filename['tmp_name'], $target_big);
        }
    }
    $target_small = $target . $picture_name;
    oos_resize_image($filename['tmp_name'], $target_small, OOS_SMALL_IMAGE_WIDTH, OOS_SMALL_IMAGE_HEIGHT, OOS_SMALLIMAGE_WAY_OF_RESIZE);
    return $picture_name;
}
    if ($_POST['remove_image'] == 'yes' && isset($_SESSION['customer_id'])) {
        $customerstable = $oostable['customers'];
        $query = "SELECT customers_image\n                  FROM {$customerstable}\n                  WHERE customers_id = '" . intval($_SESSION['customer_id']) . "'";
        $customers_image = $dbconn->GetOne($query);
        @unlink(OOS_ABSOLUTE_PATH . OOS_IMAGES . OOS_CUSTOMERS_IMAGES . $customers_image);
        $customerstable = $oostable['customers'];
        $query = "UPDATE {$customerstable}" . " SET customers_image = ?" . " WHERE customers_id = ?";
        $result =& $dbconn->Execute($query, array('', (int) $_SESSION['customer_id']));
    }
    require_once 'includes/classes/class_upload.php';
    if (oos_is_not_null($_FILES['id']['tmp_name']) and $_FILES['id']['tmp_name'] != 'none') {
        $customers_image_file = new upload('id');
        $customers_image_file->set_destination(OOS_ABSOLUTE_PATH . OOS_IMAGES . OOS_CUSTOMERS_IMAGES);
        if ($customers_image_file->parse()) {
            if (isset($_SESSION['customer_id'])) {
                $extension = oos_get_extension($_FILES['id']['name']);
                $picture_tempname = oos_get_random_picture_name(26, $extension);
                $customers_image_file->set_filename($picture_tempname);
                $customerstable = $oostable['customers'];
                $query = "UPDATE {$customerstable}" . " SET customers_image = ?" . " WHERE customers_id = ?";
                $result =& $dbconn->Execute($query, array((string) $picture_tempname, (int) $_SESSION['customer_id']));
                $customers_image_file->save();
            }
        }
    }
}
require 'includes/languages/' . $sLanguage . '/user_customers_image.php';
$customerstable = $oostable['customers'];
$address_bookstable = $oostable['address_book'];
$customers_infotable = $oostable['customers_info'];
$sql = "SELECT c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_image,\n               a.entry_city, a.entry_country_id, ci.customers_info_date_account_created AS date_account_created\n        FROM {$customerstable} c,\n             {$address_bookstable} a,\n             {$customers_infotable} ci\n        WHERE c.customers_id = '" . intval($_SESSION['customer_id']) . "'\n          AND a.customers_id = c.customers_id\n          AND ci.customers_info_id = c.customers_id\n          AND a.address_book_id = '" . intval($_SESSION['customer_default_address_id']) . "'";