/**
     * 用户登录入口
     *
     * @author  weberliu
     * @return  void
     */
    function login()
    {
        if ($_SERVER['REQUEST_METHOD'] == 'GET')
        {
            include_once(ROOT_PATH . '/includes/models/mod.order.php');
            Language::load_lang(lang_file('shopping')); // 用户信息
            $ecm_username = ecm_getcookie('ECM_USERNAME');
            $this->assign('ret_url', $this->get_ret_url());
            $this->assign('login_captcha', $this->login_captcha()); //验证码
            $this->assign('user_name', $ecm_username ? $ecm_username : '');
            $from = 0;            if ($_GET['from'] == 'shopping')
            {
                $this->assign('allow_anonymous_buy', $this->conf('mall_allow_guest_buy'));
                $from = 1;
            }
            $this->assign('from', $from);
            $this->display('mc_login', 'mall');
        }
        else
        {
            $user_name  = trim($_POST['user_name']);
            $password   = $_POST['password']; //密码允许使用空格
            $captcha    = empty($_POST['captcha']) ? '' : trim($_POST['captcha']); //验证码
            $cookie_expire = intval($_POST['expire']);            /* 验证码 */
            if (!$this->login_captcha($captcha))
            {
                $this->show_warning('captcha_invalid', 'relogin', 'index.php?app=member&act=login&ret_url=' . urlencode($this->get_ret_url()));                return;
            }            $user = new User(0, 0);
            $row = $user->login($user_name, $password);
            if ($row['uid'] > 0)
            {
                unset($_SESSION['ERROR_LOGIN']); //清除登录失败错误次数
                ecm_setcookie('ECM_USERNAME', $row['username']); //记录登录用户名
                $user_synlogin = $user->sync_login();                $_SESSION['timezone'] = $this->conf('mall_time_zone');                $login_sucess_message = $this->str_format('welcome_to_login', $_SESSION['user_name'], $this->conf('mall_title'));
                $this->show_message($login_sucess_message . $user_synlogin, 'auto_link', $this->get_ret_url());
                return;
            }
            else
            {
                //记录登录失败次数
                if (isset($_SESSION['ERROR_LOGIN']))
                {
                    $_SESSION['ERROR_LOGIN'] ++;
                }
                else
                {
                    $_SESSION['ERROR_LOGIN'] = 1;
                }
                if ($row['uid'] == -1)
                {
                    $msg_error_login = 'login_user_no_exists';
                }
                else
                {
                    $msg_error_login = 'login_pass_error';
                }
                $this->show_warning ($msg_error_login, 'relogin', 'index.php?app=member&act=login&ret_url=' . urlencode($this->get_ret_url()), 'forget_pwd', 'index.php?app=member&act=getpwd');
                return;
            }
        }
    }

解决方案 »

  1.   


        function get_count($condition)
        {
            $where      = $this->_make_condition($condition);
            $sql        = "SELECT COUNT(*) FROM `ecm_admin_user` WHERE $where AND store_id='" . $this->store_id . "'";
            $rec_count  = $GLOBALS['db']->getOne($sql);        return $rec_count;
        }
      

  2.   

     function welcome()
        {
            include(ROOT_PATH . '/includes/inc.constant.php');
            include(ROOT_PATH . '/admin/includes/inc.stat.php');        /* 取得站内动态 */
            $newmember_count            = get_member_count('today');
            $newgoods_count             = get_goods_count('today');
            $newstore_count             = get_store_count('today');
            $today_finish_order_count   = get_order_count('today', 'finish', 'number');        /* 取得统计信息 */        $this->stat_info['member_count']           = get_member_count('unlimited');
            $this->stat_info['goods_count']            = get_goods_count('unlimited');
            $this->stat_info['store_count']            = get_store_count('unlimited');
            $this->stat_info['order_count']            = get_order_count('unlimited');
            $this->stat_info['finish_order_amount']    = get_order_count('unlimited', 'finish', 'amount');
            $this->stat_info['all_finish_order_count'] = get_order_count('unlimited', 'finish', 'number');
            /* 取得系统信息 */
            $sysinfo['server_os']       = PHP_OS;
            $sysinfo['web_server']      = $_SERVER['SERVER_SOFTWARE'];
            $sysinfo['php_version']     = PHP_VERSION;
            $sysinfo['mysql_version']   = $GLOBALS['db']->version();
            $sysinfo['current_version'] = VERSION;
            $sysinfo['install_date']    = local_date('Y-m-d H:i', file_get_contents(ROOT_PATH . '/data/install.lock'));
            $this->assign('install_dir_exists',     is_dir(ROOT_PATH . '/install'));
            $this->assign('site_domain',            urlencode(site_url()));        /* 当前程序信息 */
            $this->assign('ecsc_lang',              CHARSET);        $this->assign('newmember_count',        $newmember_count);
            $this->assign('newgoods_count',         $newgoods_count);
            $this->assign('newstore_count',         $newstore_count);
            $this->assign('finish_order_count',     $today_finish_order_count);        $this->assign('member_count',           $this->stat_info['member_count']);
            $this->assign('goods_count',            $this->stat_info['goods_count']);
            $this->assign('store_count',            $this->stat_info['store_count']);
            $this->assign('order_count',            $this->stat_info['order_count']);
            $this->assign('finish_order_amount',    $this->stat_info['finish_order_amount']);
            $this->assign('all_finish_order_count', $this->stat_info['all_finish_order_count']);
            $this->assign('new_apply_count',        get_new_apply_count());        $this->assign('sysinfo',                $sysinfo);
            $this->assign('CURRENT_VERSION',        CURRENT_VERSION);
            $this->assign('spt',                    $this->update_site_information());        parent::welcome();
        }
      

  3.   


        function view()
        {
            $this->logger=false;
            if (!isset($_COOKIE['ecm_config']['category_fold']))
            {
                ecm_setcookie('ecm_config[category_fold]', 1, time() + 3600 * 24 * 30);
                $_COOKIE['ecm_config']['category_fold'] = 1;
            }
            $fold = empty($_COOKIE['ecm_config']['category_fold']) ? 0 : 1;
            $category = new Category(0, $_SESSION['store_id']);
            $cate_infos = $category->list_child();
            $this->assign('cate_infos', $cate_infos);
            $this->assign('stat_info', $this->str_format('stat_info', count($cate_infos)));
            $this->assign('fold',   $fold);
            $this->display('category.view.html');    }