Ejemplo n.º 1
0
    $rs['sort'] = $sort;
    $rs['smallimage'] = $smallImage;
    $rs['bigimage'] = $bigImage;
    $insertSql = $db->GetInsertSQL($result, $rs);
    $db->Execute($insertSql);
    admin_msg('picture.php?action=showpic&cid=' . $_POST['cid'], '图片上传成功!');
} elseif ($_POST['action'] == 'picsaveedit') {
    //====================================================编辑产品
    $id = $_POST['id'];
    $url = $_POST['url'];
    $smallImage = $_POST['smallimage'];
    $bigImage = $_POST['bigimage'];
    if ($_FILES['imagefile']['name']) {
        //图片上传
        $up = new upimg_class();
        $result = $up->upload('imagefile');
        if (!$result) {
            admin_msg($_SERVER['HTTP_REFERER'], '图片上传错误:' . $up->error);
        }
        $smallImage = $up->thumbName;
        $bigImage = $up->imgName;
        //删除原始图片
        if (is_file('../uploads/' . $_POST['smallimage'] . '')) {
            //删除小图片
            @unlink('../uploads/' . $_POST['smallimage'] . '');
        }
        if (is_file('../uploads/' . $_POST['bigimage'] . '')) {
            //删除大图片
            @unlink('../uploads/' . $_POST['bigimage'] . '');
        }
    }
Ejemplo n.º 2
0
    } else {
        admin_msg($_SERVER['HTTP_REFERER'], '参数错误!');
    }
} elseif ($_POST['action'] == 'saveedit') {
    //====================================================编辑文章
    $rs = array();
    $rs['title'] = $_POST['title'];
    //$rs['cid']=$_POST['cid'];
    $rs['keywords'] = $_POST['keywords'];
    $rs['description'] = $_POST['description'];
    //$rs['outlink']=$_POST['outlink'];
    $rs['content'] = $_POST['p_info'];
    if ($_FILES['imagefile']['name']) {
        //图片上传
        $up = new upimg_class("../uploads/about/gszl", null);
        $rs_up = $up->upload('imagefile');
        if (!$rs_up) {
            admin_msg($_SERVER['HTTP_REFERER'], '图片上传错误:' . $up->error);
        }
        $pathImg = $up->imgName;
        $rs["bigimage"] = replacePath($pathImg);
        if (is_file(ADMIN . $_POST['bigimageold'])) {
            //删除原图片
            @unlink(ADMIN . $_POST['bigimageold']);
        }
    }
    $id = $_POST['id'];
    $result = $db->Execute('SELECT * FROM mycms_article_list WHERE id=' . $id . '');
    $updateSql = $db->GetUpdateSQL($result, $rs);
    $db->Execute($updateSql);
    $url = $_POST['url'];
Ejemplo n.º 3
0
} elseif ($_POST["action"] == "savepic") {
    $up = new upimg_class("../uploads/images/index/banner", null);
    //$url=$_POST['url'];
    $url = "index.php?action=content";
    for ($i = 1; $i <= 3; $i++) {
        $rs = array();
        //获取id 用于判断是修改还是添加
        $id = -1;
        if (isset($_POST["id" . $i])) {
            $id = $_POST["id" . $i];
        }
        //选择了文件或者添加的情况
        if ($_FILES['bg' . $i]['name'] || $id == -1) {
            $rs["cid"] = $_POST["cid"];
            $rs["name"] = "首页轮播图片";
            $result = $up->upload('bg' . $i);
            if (!$result) {
                admin_msg($url, '图片上传错误:' . $up->error);
            }
            $rs["content"] = replacePath($up->imgName);
        }
        if ($_FILES['right' . $i]['name']) {
            $result = $up->upload('right' . $i);
            if (!$result) {
                admin_msg($url, '图片上传错误:' . $up->error);
            }
            $rs["smallimage"] = replacePath($up->imgName);
        }
        if ($_FILES['left' . $i]['name']) {
            $result = $up->upload('left' . $i);
            if (!$result) {
Ejemplo n.º 4
0
        $result = $db->GetRow('SELECT * FROM mycms_article_class WHERE cid=' . $cid);
        $smarty->assign($result);
        $smarty->display("admin/pages/scheme-classedit.tpl.html");
    } else {
        admin_msg('scheme.php?action=class', '参数不正确,不能删除分类!');
    }
} elseif ($_POST['action'] == 'classupdate') {
    //==================================================修改分类
    $cid = $_POST['cid'];
    $cname = $_POST['cname'];
    if (!empty($cid) && !empty($cname)) {
        $rs = array();
        if ($_FILES['icon']['name']) {
            //图片上传
            $up = new upimg_class("../uploads/icons/menu", null);
            $result = $up->upload('icon');
            if (!$result) {
                admin_msg($_SERVER['HTTP_REFERER'], '图片上传错误:' . $up->error);
            }
            $rs["icon"] = preg_replace("/\\.\\.\\//", "", $up->imgName);
            if (is_file(ADMIN . $_POST['iconold'])) {
                //删除原图片
                @unlink(ADMIN . $_POST['iconold']);
            }
        }
        $rs['sort'] = $_POST['sort'];
        if (isset($_POST['ccontent'])) {
            $rs['ccontent'] = $_POST['ccontent'];
        }
        if (isset($_POST['keywords'])) {
            $rs['keywords'] = $_POST['keywords'];
Ejemplo n.º 5
0
     $result = $up->upload('icon');
     if (!$result) {
         admin_msg($_SERVER['HTTP_REFERER'], '图片上传错误:' . $up->error);
     }
     $rs["icon"] = preg_replace("/\\.\\.\\//", "", $up->imgName);
     //删除原始图片
     //log3(ADMIN.$_POST['iconold']);
     if (is_file(ADMIN . $_POST['iconold'])) {
         //删除原图片
         @unlink(ADMIN . $_POST['iconold']);
     }
 }
 if ($_FILES['bigImg']['name']) {
     //图片上传
     $up = new upimg_class("../uploads/products", null);
     $result = $up->upload('bigImg');
     if (!$result) {
         admin_msg($_SERVER['HTTP_REFERER'], '图片上传错误:' . $up->error);
     }
     $rs["img"] = preg_replace("/\\.\\.\\//", "", $up->imgName);
     //删除原始图片
     if (is_file(ADMIN . $_POST['imgold'])) {
         //删除原图片
         @unlink(ADMIN . $_POST['imgold']);
     }
 }
 $rs["cid"] = $cid;
 $rs['cname'] = $_POST['cname'];
 $rs['ckeywords'] = $_POST['ckeywords'];
 if (isset($_POST['cdescription'])) {
     $rs['cdescription'] = $_POST['cdescription'];