public function execute()
 {
     $userService = ServiceFactory::factory('User');
     $username = is_null($this->getParam('email')) ? '' : trim($this->getParam('email'));
     $enCryptedPassword = is_null($this->getParam('pwd')) ? '' : trim($this->getParam('pwd'));
     $password = CryptoUtil::Crypto($enCryptedPassword, 'AES-256', KANCART_APP_SECRET, false);
     $this->language->load('account/register');
     if (strlen(utf8_decode($username)) > 96 || !preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/i', $username)) {
         $this->setError(KancartResult::ERROR_USER_INVALID_USER_DATA, $this->language->get('error_email'));
         return;
     }
     if (strlen($password) < 4 || strlen($password) > 20) {
         $this->setError(KancartResult::ERROR_USER_INVALID_USER_DATA, $this->language->get('error_password'));
         return;
     }
     $firstname = is_null($this->getParam('firstname')) ? '' : trim($this->getParam('firstname'));
     $lastname = is_null($this->getParam('lastname')) ? '' : trim($this->getParam('lastname'));
     $telephone = is_null($this->getParam('telephone')) ? '' : trim($this->getParam('telephone'));
     $regisetInfo = array('firstname' => $firstname, 'lastname' => $lastname, 'email' => $username, 'telephone' => $telephone, 'password' => $password);
     if (!$userService->register($regisetInfo)) {
         $this->setError(KancartResult::ERROR_USER_INVALID_USER_DATA, $msg);
         return;
     }
     // succed registering
     $this->setSuccess();
 }
 public function execute()
 {
     $userService = ServiceFactory::factory('User');
     $username = is_null($this->getParam('uname')) ? '' : trim($this->getParam('uname'));
     if (empty($username)) {
         $this->setError(KancartResult::ERROR_USER_INPUT_PARAMETER, 'User name is empty.');
         return;
     }
     $encryptedPassword = is_null($this->getParam('pwd')) ? '' : trim($this->getParam('pwd'));
     $password = CryptoUtil::Crypto($encryptedPassword, 'AES-256', KANCART_APP_SECRET, false);
     if (!$password) {
         $this->setError(KancartResult::ERROR_USER_INPUT_PARAMETER, 'Password is empty.');
         return;
     }
     $loginInfo = array('email' => $username, 'password' => $password);
     $login = $userService->login($loginInfo);
     if (is_string($login)) {
         $this->setError(KancartResult::ERROR_USER_INPUT_PARAMETER, $login);
         return;
     }
     $cacheKey = $this->customer->getCustomerGroupId() . '-' . $this->config->get('config_customer_price');
     if ($this->config->get('config_tax')) {
         $query = $this->db->query("SELECT gz.geo_zone_id FROM " . DB_PREFIX . "geo_zone gz LEFT JOIN " . DB_PREFIX . "zone_to_geo_zone z2gz ON (z2gz.geo_zone_id = gz.geo_zone_id) WHERE (z2gz.country_id = '0' OR z2gz.country_id = '" . (int) $this->customer->country_id . "') AND (z2gz.zone_id = '0' OR z2gz.zone_id = '" . (int) $this->customer->zone_id . "')");
         if ($query->num_rows) {
             $cacheKey .= '-1-' . $query->row['geo_zone_id'];
         } else {
             $cacheKey .= '-1-0';
         }
     } else {
         $cacheKey .= '-0-0';
     }
     $info = array('sessionkey' => md5($username . uniqid(mt_rand(), true)), 'cachekey' => $cacheKey);
     $this->setSuccess($info);
 }
$param['client'] = 'cart';
$param['do_upgrade'] = TRUE;
function createSign(array $param, $secret)
{
    unset($param["sign"]);
    ksort($param);
    reset($param);
    $tempStr = "";
    foreach ($param as $key => $value) {
        $tempStr = $tempStr . $key . $value;
    }
    $tempStr = $tempStr . $secret;
    return strtoupper(md5($tempStr));
}
$param['sign'] = createSign($param, KANCART_APP_SECRET);
$param['app_key'] = CryptoUtil::Crypto($param["app_key"], 'AES-256', KANCART_APP_SECRET, true);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html;  charset=utf-8" />
        <title><?php 
echo ucwords($cartType) . ' Auto Upgrade';
?>
</title>
        <script src="http://www.kancart.com/js/jquery-1.4.1.min.js" type="text/javascript"></script>   
        <style type="text/css">
            .upgrade_now {
                display: block; 
                height: 36px; 
                width: 155px;