query('SELECT * FROM `' . $db_mymps . 'goods` ' . $where . ' AND goodsid ' . $create_in); while ($row = $db->fetchRow($query)) { $delete[$row['id']]['picture'] = $row['picture']; $delete[$row['id']]['pre_picture'] = $row['pre_picture']; } foreach ($delete as $k => $v) { @unlink(MYMPS_ROOT . $v['picture']); @unlink(MYMPS_ROOT . $v['pre_picture']); } $db->query('DELETE FROM `' . $db_mymps . 'goods` ' . $where . ' AND goodsid ' . $create_in); unset($delete); unset($row); unset($query); unset($create_in); write_msg('', '?m=goods&type=corp&success=3&status=' . $status . '&page=' . $page); } include MYMPS_DATA . '/config.inc.php'; $name_file = 'goods_image'; $goodsname = trim($goodsname); $content = trim($content); $catid = intval($catid); $oicq = trim($oicq); $oldprice = trim($oldprice); $nowprice = trim($nowprice); $oicq = trim($oicq); $tuihuan = intval($tuihuan); $baozhang = intval($baozhang); $jiayi = intval($jiayi); $weixiu = intval($weixiu); $fahuo = intval($fahuo); $cuxiao = intval($cuxiao); $goodsbh = date('Ymd') . random(3); $huoyuan = intval($huoyuan); if (empty($goodsname)) { write_msg('', '?m=goods&type=corp&ac=detail&error=42&id=' . $id); } if (empty($content)) { write_msg('', '?m=goods&type=corp&ac=detail&error=43&id=' . $id); } if (empty($catid)) { write_msg('', '?m=goods&type=corp&ac=detail&error=44&id=' . $id); } if ($_FILES[$name_file]['name']) { require_once MYMPS_INC . '/upfile.fun.php'; check_upimage($name_file); $destination = '/goods/' . date('Ym') . '/'; $mymps_image = empty($id) ? start_upload($name_file, $destination, 0, $mymps_mymps['cfg_goods_limit']['width'], $mymps_mymps['cfg_goods_limit']['height']) : start_upload($name_file, $destination, 0, $mymps_mymps['cfg_goods_limit']['width'], $mymps_mymps['cfg_goods_limit']['height'], $picture, $pre_picture); $picture = $mymps_image[0]; $pre_picture = $mymps_image[1]; unset($mymps_image); unset($_FILES); } if (empty($id)) { $db->query('INSERT INTO `' . $db_mymps . 'goods` (goodsname,goodsbh,catid,oicq,oldprice,nowprice,content,pre_picture,picture,userid,dateline,tuihuan,jiayi,weixiu,fahuo,cuxiao,baozhang,huoyuan,gift) VALUES (\'' . $goodsname . '\',\'' . $goodsbh . '\',\'' . $catid . '\',\'' . $oicq . '\',\'' . $oldprice . '\',\'' . $nowprice . '\',\'' . $content . '\',\'' . $pre_picture . '\',\'' . $picture . '\',\'' . $s_uid . '\',\'' . $timestamp . '\',\'' . $tuihuan . '\',\'' . $jiayi . '\',\'' . $weixiu . '\',\'' . $fahuo . '\',\'' . $cuxiao . '\',\'' . $baozhang . '\',\'' . $huoyuan . '\',\'' . $gift . '\')'); $id = $db->insert_id(); $score_change = get_credit_score(); $score_changer = $score_change['score']['rank']['goods']; $db->query('UPDATE `' . $db_mymps . 'member` SET score = score' . $score_changer . (' WHERE userid = \'' . $s_uid . '\'')); $score_change = $score_changer = NULL; $url = '?m=goods&type=corp&success=8&ac=detail&id=' . $id . '&alert=4'; } else { $db->query('UPDATE `' . $db_mymps . 'goods` SET goodsname = \'' . $goodsname . '\',catid = \'' . $catid . '\',oicq=\'' . $oicq . '\',oldprice = \'' . $oldprice . '\',nowprice = \'' . $nowprice . '\',content = \'' . $content . '\',pre_picture=\'' . $pre_picture . '\',picture=\'' . $picture . '\',dateline=\'' . $timestamp . '\',tuihuan = \'' . $tuihuan . '\',jiayi = \'' . $jiayi . '\',weixiu=\'' . $weixiu . '\',fahuo=\'' . $fahuo . '\',cuxiao=\'' . $cuxiao . '\',baozhang=\'' . $baozhang . '\',huoyuan = \'' . $huoyuan . '\',gift=\'' . $gift . '\' ' . $where . ' AND goodsid = \'' . $id . '\''); } write_msg('', $url ? $url : '?m=goods&type=corp&success=8&ac=detail&id=' . $id); } else if (submit_check('goods_order_submit')) { empty($selectids) && write_msg('', '?m=goods&type=corp&ac=order&error=1&page=' . $page); $db->query('DELETE FROM `' . $db_mymps . 'goods_order` ' . $where . ' AND id ' . create_in($selectedids)); unset($selectedids); write_msg('', '?m=goods&type=corp&success=3&ac=order&page=' . $page); } else { @include_once MYMPS_DATA . '/moneytype.inc.php'; if ($ac == 'list') { $rows_num = mymps_count('goods', $where); $param = setParam(array('m', 'type', 'ac')); $goods = page1('SELECT * FROM `' . $db_mymps . 'goods` ' . $where . ' ORDER BY dateline DESC'); } else if ($ac == 'detail') { @require_once MYMPS_ROOT . '/plugin/goods/include/functions.php'; if ($id) { $edit = $db->getRow('SELECT * FROM `' . $db_mymps . 'goods` WHERE goodsid = \'' . $id . '\''); } $acontent = get_editor('content', 'Member', $edit['content'], '90%', '400px'); } else if ($ac == 'order') { if (empty($id)) { $param = setParam('m', 'ac', 'id'); $rows_num = $db->getOne('SELECT COUNT(a.id) FROM `' . $db_mymps . 'goods_order` AS a LEFT JOIN `' . $db_mymps . 'goods` AS b ON a.goodsid = b.goodsid WHERE b.userid = \'' . $s_uid . '\''); $order = page1('SELECT a.*,b.goodsname FROM `' . $db_mymps . 'goods_order` AS a LEFT JOIN `' . $db_mymps . 'goods` AS b ON a.goodsid = b.goodsid WHERE b.userid = \'' . $s_uid . '\' ORDER BY dateline DESC'); } else { $order = $db->getRow('SELECT a.*,b.goodsname FROM `' . $db_mymps . 'goods_order` AS a LEFT JOIN `' . $db_mymps . 'goods` AS b ON a.goodsid = b.goodsid WHERE b.userid = \'' . $s_uid . '\' AND a.id = \'' . $id . '\''); $ac = $ac . '_view'; } } $location = location('corp'); include mymps_tpl('goods_' . $ac); unset($glevel); } ?>