/* 模板赋值 */ $goods_ur = array('' => $_LANG['01_goods_list'], 'virtual_card' => $_LANG['50_virtual_card_list']); $smarty->assign('ur_here', '特产商品列表'); $action_link = array('href' => 'goods.php?act=add', 'text' => '添加商品'); $smarty->assign('action_link', $action_link); $smarty->assign('code', $code); //$smarty->assign('cat_list', cat_list(0, $cat_id));// 注释 2015-03-19 代理商跟主站的分类分开 /*ccx 2015-03-18 代理商显示代理商自己的商品分类 start */ $smarty->assign('cat_list', cat_list_ccx(0, $cat_id)); /*ccx 2015-03-18 代理商显示代理商自己的商品分类 end */ $smarty->assign('brand_list', get_brand_list()); $smarty->assign('intro_list', get_intro_list()); $smarty->assign('lang', $_LANG); $smarty->assign('list_type', $_REQUEST['act'] == 'list' ? 'goods' : 'trash'); $smarty->assign('use_storage', empty($_CFG['use_storage']) ? 0 : 1); $suppliers_list = suppliers_list_info(' is_check = 1 '); $suppliers_list_count = count($suppliers_list); $smarty->assign('suppliers_list', $suppliers_list_count == 0 ? 0 : $suppliers_list); // 取供货商列表 $goods_list = goods_list(0, 1, ' AND is_special=1 '); //dump($goods_list); $smarty->assign('goods_list', $goods_list['goods']); $smarty->assign('filter', $goods_list['filter']); $smarty->assign('record_count', $goods_list['record_count']); $smarty->assign('page_count', $goods_list['page_count']); $smarty->assign('full_page', 1); /* 排序标记 */ $sort_flag = sort_flag($goods_list['filter']); $smarty->assign($sort_flag['tag'], $sort_flag['img']); /* 获取商品类型存在规格的类型 */ $specifications = get_goods_type_specifications();
/** * 供货商名 * * @return array */ function suppliers_list_name() { /* 查询 */ $suppliers_list = suppliers_list_info(' is_check = 1 '); /* 供货商名字 */ $suppliers_name = array(); if (count($suppliers_list) > 0) { foreach ($suppliers_list as $suppliers) { $suppliers_name[$suppliers['suppliers_id']] = $suppliers['suppliers_name']; } } return $suppliers_name; }
include_once ROOT_PATH . 'includes/cls_captcha.php'; /* 检查验证码是否正确 */ $validator = new captcha(); if (!empty($_POST['captcha']) && !$validator->check_word($_POST['captcha'])) { sys_msg($_LANG['captcha_error'], 1); } } $_POST['username'] = isset($_POST['username']) ? trim($_POST['username']) : ''; $_POST['password'] = isset($_POST['password']) ? trim($_POST['password']) : ''; /* 检查密码是否正确 */ $sql = "SELECT user_id, user_name, password, last_login, action_list, last_login, suppliers_id" . " FROM " . $ecs->table('admin_user') . " WHERE user_name = '" . $_POST['username'] . "' AND password = '******'password']) . "'"; $row = $db->getRow($sql); if ($row) { // 检查是否为供货商的管理员 所属供货商是否有效 if (!empty($row['suppliers_id'])) { $supplier_is_check = suppliers_list_info(' is_check = 1 AND suppliers_id = ' . $row['suppliers_id']); if (empty($supplier_is_check)) { sys_msg($_LANG['login_disable'], 1); } } // 登录成功 set_admin_session($row['user_id'], $row['user_name'], $row['action_list'], $row['last_login']); $_SESSION['suppliers_id'] = $row['suppliers_id']; if ($row['action_list'] == 'all' && empty($row['last_login'])) { $_SESSION['shop_guide'] = true; } // 更新最后登录时间和IP $db->query("UPDATE " . $ecs->table('admin_user') . " SET last_login='******', last_ip='" . real_ip() . "'" . " WHERE user_id='{$_SESSION['admin_id']}'"); if (isset($_POST['remember'])) { $time = gmtime() + 3600 * 24 * 365; setcookie('ECSCP[admin_id]', $row['user_id'], $time);
include_once ROOT_PATH . 'includes/cls_captcha.php'; /* 检查验证码是否正确 */ $validator = new captcha(); if (!empty($_POST['captcha']) && !$validator->check_word($_POST['captcha'])) { show_api_message('验证码错误', '管理员登录', $php_self . '?act=login', 'error'); } } $_POST['username'] = isset($_POST['username']) ? trim($_POST['username']) : ''; $_POST['password'] = isset($_POST['password']) ? trim($_POST['password']) : ''; $sql = "SELECT * FROM " . $ecs->table('admin_user') . "WHERE user_name = '" . $_POST['username'] . "'"; $admin_user = $db->getRow($sql); $is_suc = isset($admin_user['ec_salt']) ? $admin_user['password'] == md5(md5($_POST['password']) . $admin_user['ec_salt']) : $admin_user['password'] == md5($_POST['password']); if ($is_suc) { // 检查是否为供货商的管理员 所属供货商是否有效 if (!empty($row['suppliers_id'])) { $supplier_is_check = suppliers_list_info(' is_check = 1 AND suppliers_id = ' . $admin_user['suppliers_id']); if (empty($supplier_is_check)) { show_api_message('您输入的帐号暂时不可用。', '管理员登录', $php_self . '?act=login', 'error'); } } // 登录成功 set_admin_session($admin_user['user_id'], $admin_user['user_name'], $admin_user['action_list'], $admin_user['last_login']); $_SESSION['suppliers_id'] = $admin_user['suppliers_id']; // 更新最后登录时间和IP $db->query("UPDATE " . $ecs->table('admin_user') . " SET last_login='******', last_ip='" . real_ip() . "'" . " WHERE user_id='{$_SESSION['admin_id']}'"); show_api_message('登录成功', '开始配置接口参数', $php_self . '?act=config', 'info'); } else { show_api_message('登录失败', '重新登录', $php_self . '?act=login', 'error'); } break; } elseif ($act == 'config') {