Exemplo n.º 1
0
 public function index()
 {
     $this->user->logout();
     unset($this->session->data['token']);
     wcore_utils::set_cookie('token', null);
     wcore_utils::set_cookie('vtoken', null);
     $this->redirect($this->url->link('common/login', '', 'SSL'));
 }
Exemplo n.º 2
0
 public function logout()
 {
     /**
      * 保存客户购物车中的所购买的产品与收藏产品
      */
     $ip = wcore_utils::get_ip();
     $cartlist = $this->mdb()->escape(isset($this->session->data['cart']) ? serialize($this->session->data['cart']) : '');
     $wishlist = $this->mdb()->escape(isset($this->session->data['wishlist']) ? serialize($this->session->data['wishlist']) : '');
     $this->mdb()->query_res("UPDATE " . DB_PREFIX . "customer SET cart = '{$cartlist}', wishlist = '{$wishlist}', ip = '{$ip}' WHERE customer_id = '{$this->customer_id}'");
     /**
      * 清除登录信息
      */
     $this->customer_id = '';
     $this->firstname = '';
     $this->lastname = '';
     $this->email = '';
     $this->telephone = '';
     $this->fax = '';
     $this->newsletter = '';
     $this->customer_group_id = '';
     $this->address_id = '';
     unset($this->session->data['customer_id']);
     wcore_utils::set_cookie('cust_id', null, -1);
     wcore_utils::set_cookie('cust_email', null, -1);
 }
Exemplo n.º 3
0
    wcore_utils::set_cookie('language', $code, 365);
}
$config->set('config_language_id', $languages[$code]['language_id']);
$config->set('config_language', $languages[$code]['code']);
//Language
$language = new Language($languages[$code]['directory']);
$language->load($languages[$code]['filename']);
$registry->set('language', $language);
//Document
$registry->set('document', new Document());
//Customer
$registry->set('customer', new Customer($registry));
//Affiliate
$registry->set('affiliate', new Affiliate($registry));
if (isset($request->get['tracking']) && !isset($request->cookie['tracking'])) {
    wcore_utils::set_cookie('tracking', $request->get['tracking'], 365);
}
//Currency
$registry->set('currency', new Currency($registry));
//Tax
$registry->set('tax', new Tax($registry));
//Weight
$registry->set('weight', new Weight($registry));
//Length
$registry->set('length', new Length($registry));
//Cart
$registry->set('cart', new Cart($registry));
//Encryption
$registry->set('encryption', new Encryption($config->get('config_encryption')));
//Front Controller
$controller = new Front($registry);
Exemplo n.º 4
0
 public function index()
 {
     $this->load->language('common/login');
     $this->document->setTitle($this->language->get('heading_title'));
     if ($this->user->isLogged() && isset($this->request->cookie['token']) && $this->request->cookie['token'] == $this->session->data['token']) {
         $this->redirect($this->url->link('common/home'));
     }
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->session->data['token'] = md5(mt_rand());
         wcore_utils::set_cookie('token', $this->session->data['token']);
         wcore_utils::set_cookie('vtoken', md5(substr($this->session->data['token'], 3, 16) . SITE_MD5_KEY));
         if (isset($this->request->post['redirect'])) {
             $this->redirect($this->request->post['redirect']);
         } else {
             $this->redirect($this->url->link('common/home'));
         }
     }
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_login'] = $this->language->get('text_login');
     $this->data['text_forgotten'] = $this->language->get('text_forgotten');
     $this->data['entry_username'] = $this->language->get('entry_username');
     $this->data['entry_password'] = $this->language->get('entry_password');
     $this->data['button_login'] = $this->language->get('button_login');
     if (isset($this->session->data['token']) && !isset($this->request->cookie['token']) || isset($this->request->cookie['token']) && (isset($this->session->data['token']) && $this->request->cookie['token'] != $this->session->data['token'])) {
         $this->error['warning'] = $this->language->get('error_token');
     }
     $this->data['error_warning'] = isset($this->error['warning']) ? $this->error['warning'] : '';
     if (isset($this->session->data['success'])) {
         $this->data['success'] = $this->session->data['success'];
         unset($this->session->data['success']);
     } else {
         $this->data['success'] = '';
     }
     $this->data['action'] = $this->url->link('common/login', '', 'SSL');
     if (isset($this->request->post['username'])) {
         $this->data['username'] = $this->request->post['username'];
     } else {
         $this->data['username'] = '';
     }
     if (isset($this->request->post['password'])) {
         $this->data['password'] = $this->request->post['password'];
     } else {
         $this->data['password'] = '';
     }
     if (isset($this->request->get['route'])) {
         $route = $this->request->get['route'];
         unset($this->request->get['route']);
         if (isset($this->request->cookie['token'])) {
             unset($this->request->cookie['token']);
         }
         $url = '';
         if ($this->request->get) {
             $url .= http_build_query($this->request->get);
         }
         $this->data['redirect'] = $this->url->link($route, $url, 'SSL');
     } else {
         $this->data['redirect'] = '';
     }
     $this->data['forgotten'] = $this->url->link('common/forgotten', '', 'SSL');
     $this->template = 'template/login.tpl';
     $this->children = array('common/header', 'common/footer');
     $this->response->setOutput($this->render());
 }
Exemplo n.º 5
0
 public function set($currency)
 {
     $this->code = $currency;
     wcore_utils::set_cookie('currency', $currency, 365);
 }
Exemplo n.º 6
0
 /**
  * 清空会话,那就意味着退出系统
  *
  */
 public static function empty_session()
 {
     wcore_utils::set_cookie('uid', null, 0);
     wcore_utils::set_cookie('uname', null, 0);
     wcore_utils::set_cookie('unick', null, 0);
     wcore_utils::set_cookie('ticket', null, 0);
     wcore_utils::set_cookie('logined', null, 0);
 }