Exemplo n.º 1
0
function action_act_identity()
{
    // 获取全局变量
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    include_once ROOT_PATH . '/includes/cls_image.php';
    $image = new cls_image($_CFG['bgcolor']);
    $real_name = $_POST['real_name'];
    $card = $_POST['card'];
    $country = $_POST['country'];
    $province = $_POST['province'];
    $city = $_POST['city'];
    $district = $_POST['district'];
    $address = $_POST['address'];
    if (isset($_FILES['face_card']) && $_FILES['face_card']['tmp_name'] != '') {
        if ($_FILES['face_card']['width'] > 800) {
            show_message('图片宽度不能超过800像素!');
        }
        if ($_FILES['face_card']['height'] > 800) {
            show_message('图片高度不能超过800像素!');
        }
        $face_card = $image->upload_image($_FILES['face_card']);
        if ($face_card === false) {
            show_message($image->error_msg());
        }
    }
    if (isset($_FILES['back_card']) && $_FILES['back_card']['tmp_name'] != '') {
        if ($_FILES['back_card']['width'] > 800) {
            show_message('图片宽度不能超过800像素!');
        }
        if ($_FILES['back_card']['height'] > 800) {
            show_message('图片高度不能超过800像素!');
        }
        $back_card = $image->upload_image($_FILES['back_card']);
        if ($back_card === false) {
            show_message($image->error_msg());
        }
    }
    $sql = "select face_card,back_card from " . $GLOBALS['ecs']->table('users') . " where user_id = '" . $_SESSION['user_id'] . "'";
    $rows = $GLOBALS['db']->getRow($sql);
    if ($rows['face_card'] == '') {
        if ($face_card == '') {
            show_message('请上传身份证正面照!');
        }
    }
    if ($rows['back_card'] == '') {
        if ($back_card == '') {
            show_message('请上传身份证背面照!');
        }
    }
    $sql = 'update ' . $GLOBALS['ecs']->table('users') . " set real_name = '{$real_name}',card='{$card}',country='{$country}',province='{$province}',city='{$city}',district='{$district}',address='{$address}',status = '2'";
    if ($face_card != '') {
        $sql .= " ,face_card = '{$face_card}'";
    }
    if ($back_card != '') {
        $sql .= " ,back_card = '{$back_card}'";
    }
    $sql .= " where user_id = '" . $_SESSION['user_id'] . "'";
    $num = $GLOBALS['db']->query($sql);
    if ($num > 0) {
        show_message('您已申请实名认证,请等待管理员的审核!', '返回上一页', 'user.php?act=profile');
    } else {
        show_message('实名认证失败!', '返回上一页', 'user.php?act=profile');
    }
}
 /* 设置最长执行时间为5分钟 */
 @set_time_limit(300);
 if (isset($_GET['start'])) {
     $page_size = 50;
     // 默认50张/页
     $thumb = empty($_GET['thumb']) ? 0 : 1;
     $watermark = empty($_GET['watermark']) ? 0 : 1;
     $change = empty($_GET['change']) ? 0 : 1;
     $silent = empty($_GET['silent']) ? 0 : 1;
     /* 检查GD */
     if ($image->gd_version() < 1) {
         make_json_error($_LANG['missing_gd']);
     }
     /* 如果需要添加水印,检查水印文件 */
     if (!empty($_CFG['watermark']) && $_CFG['watermark_place'] > 0 && $watermark && !$image->validate_image($_CFG['watermark'])) {
         make_json_error($image->error_msg());
     }
     $title = '';
     if (isset($_GET['total_icon'])) {
         $count = $db->GetOne("SELECT COUNT(*) FROM " . $ecs->table('goods') . " AS g WHERE g.original_img <> ''" . $goods_where);
         $title = sprintf($_LANG['goods_format'], $count, $page_size);
     }
     if (isset($_GET['total_album'])) {
         $count = $GLOBALS['db']->GetOne("SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('goods_gallery') . ' AS album ' . $album_where);
         $title = sprintf('&nbsp;' . $_LANG['gallery_format'], $count, $page_size);
         $module_no = 1;
     }
     $result = array('error' => 0, 'message' => '', 'content' => '', 'module_no' => $module_no, 'done' => 1, 'title' => $title, 'page_size' => $page_size, 'page' => 1, 'thumb' => $thumb, 'watermark' => $watermark, 'total' => 1, 'change' => $change, 'silent' => $silent, 'do_album' => $do_album, 'do_icon' => $do_icon, 'goods_id' => $goods_id, 'brand_id' => $brand_id, 'cat_id' => $cat_id, 'row' => array('new_page' => sprintf($_LANG['page_format'], 1), 'new_total' => sprintf($_LANG['total_format'], ceil($count / $page_size)), 'new_time' => $_LANG['wait'], 'cur_id' => 'time_1'));
     die($json->encode($result));
 } else {
     $result = array('error' => 0, 'message' => '', 'content' => '', 'done' => 2, 'do_album' => $do_album, 'do_icon' => $do_icon, 'goods_id' => $goods_id, 'brand_id' => $brand_id, 'cat_id' => $cat_id);
Exemplo n.º 3
0
     }
 }
 $goods_img = '';
 // 初始化商品图片
 $goods_thumb = '';
 // 初始化商品缩略图
 $original_img = '';
 // 初始化原始图片
 $old_original_img = '';
 // 初始化原始图片旧图
 // 如果上传了商品图片,相应处理
 if ($_FILES['goods_img']['tmp_name'] != '' && $_FILES['goods_img']['tmp_name'] != 'none') {
     $original_img = $image->upload_image($_FILES['goods_img']);
     // 原始图片
     if ($original_img === false) {
         sys_msg($image->error_msg(), 1, array(), false);
     }
     $goods_img = $original_img;
     // 商品图片
     /* 复制一份相册图片 */
     $img = $original_img;
     // 相册图片
     $pos = strpos(basename($img), '.');
     $newname = dirname($img) . '/' . $image->random_filename() . substr(basename($img), $pos);
     if (!copy('../' . $img, '../' . $newname)) {
         sys_msg('fail to copy file: ' . realpath('../' . $img), 1, array(), false);
     }
     $img = $newname;
     $gallery_img = $img;
     $gallery_thumb = $img;
     // 如果系统支持GD,缩放商品图片,且给商品图片和相册图片加水印
Exemplo n.º 4
0
    }
} elseif ($_REQUEST['act'] == 'add') {
    $smarty->assign('from_act', 'add_menu');
    $smarty->assign('action_link', array('text' => '菜单列表', 'href' => 'menu.php?act=list'));
    $smarty->display('menu_info.htm');
} elseif ($_REQUEST['act'] == 'add_menu') {
    include_once ROOT_PATH . '/includes/cls_image.php';
    $image = new cls_image($_CFG['bgcolor']);
    $menu_name = $_REQUEST['menu_name'];
    $menu_url = $_REQUEST['menu_url'];
    $sort = $_REQUEST['sort'];
    if (isset($_FILES['menu_img']) && $_FILES['menu_img']['tmp_name'] != '' && isset($_FILES['menu_img']['tmp_name']) && $_FILES['menu_img']['tmp_name'] != 'none') {
        // 上传了,直接使用,原始大小
        $menu_img = $image->upload_image($_FILES['menu_img']);
        if ($menu_img === false) {
            show_message($image->error_msg());
        }
    }
    if ($menu_img == '') {
        sys_msg('菜单图片不能为空!', 0, $link);
    }
    $sql = "insert into " . $GLOBALS['ecs']->table('ecsmart_menu') . "(`menu_name`,`menu_img`,`menu_url`,`sort`) values('{$menu_name}','{$menu_img}','{$menu_url}','{$sort}')";
    $num = $GLOBALS['db']->query($sql);
    if ($num > 0) {
        sys_msg('添加菜单成功!', 0, $link);
    } else {
        sys_msg('添加菜单失败!', 0, $link);
    }
}
function get_all_menu()
{