function registerAction()
 {
     $tblCatalog = new App_Model_Db_Table_Catalog();
     $rowset = $tblCatalog->fetchRow("shortTitle='halaman-depan-login' AND status=99");
     if (!empty($rowset)) {
         $fixedContent = App_Model_Show_CatalogAttribute::show()->getCatalogAttributeValue($rowset->guid, 'fixedContent');
     } else {
         $fixedContent = '';
     }
     $this->view->content = $fixedContent;
     $this->view->identity = 'Register';
     $sReturn = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
     $sReturn = base64_encode($sReturn);
     $this->view->login = $sReturn;
     $r = $this->getRequest();
     if ($r->isPost()) {
         $username = $r->getParam('username');
         $password = $r->getParam('password');
         $email = $r->getParam('email');
         $package = $r->getParam('aro_groups');
         $obj = new Pandamp_Crypt_Password();
         $data = array('kopel' => $this->generateKopel(), 'username' => $username, 'password' => $obj->encryptPassword($password), 'email' => $email, 'packageId' => $package, 'createdDate' => date('Y-m-d h:i:s'), 'createdBy' => $username);
         $modelUser = new App_Model_Db_Table_User();
         $modelUser->insert($data);
         $this->updateKopel();
         $acl = Pandamp_Acl::manager();
         $acl->addUser($username, "Member Free");
     }
 }
Exemple #2
0
 public function login_saver()
 {
     if ($this->save_login == "no" || $this->save_login == "undefined") {
         if (isset($_COOKIE[$this->cookie_name])) {
             $expire = time() - 3600;
         } else {
             return;
         }
     } else {
         $expire = time() + 2592000;
     }
     $obj = new Pandamp_Crypt_Password();
     $cookie_str = $this->user . chr(31) . $obj->encryptPassword($this->user_pw);
     setcookie($this->cookie_name, $cookie_str, $expire, $this->cookie_path);
 }
Exemple #3
0
 public function save($aData)
 {
     $gman = new Pandamp_Core_Guid();
     $guid = isset($aData['guid']) && !empty($aData['guid']) ? $aData['guid'] : $gman->generateGuid();
     //if not empty, there are 2 possibilities
     $tblUser = new Pandamp_Modules_Identity_User_Model_User();
     $row = $tblUser->fetchRow("guid='{$guid}'");
     if (empty($row)) {
         if (empty($aData['username'])) {
             throw new Zend_Exception('Username can not be EMPTY!');
         }
         if (empty($aData['password'])) {
             throw new Zend_Exception('Password can not be EMPTY!');
         }
         $row = $tblUser->createRow();
         if (isset($aData['password']) && !empty($aData['password'])) {
             $password = $aData['password'];
             $crypt = new Pandamp_Crypt_Password();
             $password = $crypt->encryptPassword($password);
             $row->password = $password;
         }
     }
     if (isset($aData['username']) && !empty($aData['username'])) {
         //check if username was already taken
         $username = $aData['username'];
         $tblUser = new Pandamp_Modules_Identity_User_Model_User();
         $rowUsername = $tblUser->fetchRow("username='******'");
         if ($rowUsername) {
             throw new Zend_Exception('Username exists');
         }
         $row->username = $aData['username'];
     }
     if (isset($aData['email'])) {
         $row->email = $aData['email'];
     }
     if (isset($aData['fullName'])) {
         $row->fullName = $aData['fullName'];
     }
     if (isset($aData['chkGender'])) {
         $row->gender = $aData['chkGender'] == 1 ? 'L' : 'P';
     }
     if (isset($aData['year'])) {
         $row->birthday = $aData['year'] . '-' . $aData['month'] . '-' . $aData['day'];
     }
     if (isset($aData['education'])) {
         $row->educationId = $aData['education'];
     }
     if (isset($aData['expense'])) {
         $row->expenseId = $aData['expense'];
     }
     if (isset($aData['company'])) {
         $row->company = $aData['company'];
     }
     if (isset($aData['businessType'])) {
         $row->businessTypeId = $aData['businessType'];
     }
     if (isset($aData['phone'])) {
         $row->phone = $aData['phone'];
     }
     if (isset($aData['fax'])) {
         $row->phone = $aData['fax'];
     }
     if (isset($aData['packageId'])) {
         $row->packageId = $aData['packageId'];
     }
     if (isset($aData['newArtikel']) && $aData['newArtikel'] == 1) {
         $row->newArticle = 'Y';
     } else {
         if (!isset($aData['email']) && !isset($aData['username'])) {
             $row->newArticle = 'N';
         }
     }
     if (isset($aData['newRegulation']) && $aData['newRegulation'] == 1) {
         $row->monthlyList = 'Y';
     } else {
         if (!isset($aData['email']) && !isset($aData['username'])) {
             $row->monthlyList = 'N';
         }
     }
     if (isset($aData['newWeeklyRegulation']) && $aData['newWeeklyRegulation'] == 1) {
         $row->weeklyList = 'Y';
     } else {
         if (!isset($aData['email']) && !isset($aData['username'])) {
             $row->weeklyList = 'N';
         }
     }
     $row->save();
     return $row;
 }
Exemple #4
0
 /**
  * _writeConfirmFreeEmail
  * @return JSON
  */
 function _writeConfirmFreeEmail($mailcontent, $fullname, $username, $password, $guid, $email, $package = '')
 {
     $obj = new Pandamp_Crypt_Password();
     $aclMan = Pandamp_Acl::manager();
     $mailcontent = str_replace('$fullname', $fullname, $mailcontent);
     $mailcontent = str_replace('$username', $username, $mailcontent);
     $mailcontent = str_replace('$password', $password, $mailcontent);
     $mailcontent = str_replace('$guid', $guid, $mailcontent);
     $mailcontent = str_replace('$package', $package, $mailcontent);
     $mail_body = $mailcontent;
     // parse ini_file
     $config = new Zend_Config_Ini(CONFIG_PATH . '/mail.ini', 'mail');
     $mailAttempt = $this->add_mail($config->mail->sender->support->email, $email, $username, $config->mail->sender->support->name, $mail_body);
     // try to save mail before send
     if ($mailAttempt) {
         $sendAttempt = $this->send_mail();
         if ($sendAttempt) {
             $message = "Please check your email at {$email}!";
             // update user
             $tblUser = new App_Model_Db_Table_User();
             $rowUser = $tblUser->find($obj->decryptPassword($guid))->current();
             if ($rowUser) {
                 $rowUser->isEmailSent = 'Y';
                 $rowUser->save();
             }
         } else {
             $message = "Error send mail but register user successfully!<br>Please contact our customer service for more information";
         }
     } else {
         $message = "Error saving mail!";
     }
     return $message;
 }
 function decryptPasswordAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $userDb = new App_Model_Db_Table_User();
     $users = $userDb->fetchAll();
     foreach ($users as $user) {
         $obj = new Pandamp_Crypt_Password();
         $passwd = $obj->decryptPassword($user->password);
         if ($passwd == 'g00dPa$$w0rD') {
             echo $user->kopel . '<br>';
         }
     }
     //echo md5('SolrRocks');
     //$obj = new Pandamp_Crypt_Password();
     //echo $obj->decryptPassword('VTIDb1o8Bz0LaApsUndSJgtoB3QDJ1x2');
     /*for($i = 1; $i <=10; $i++) {
       
       	$plainPassword = $this->generateRandomString();
       	$cryptedPassword = $obj->encryptPassword($plainPassword);
       	$deCryptedPassword = $obj->decryptPassword($cryptedPassword);
       	echo $cryptedPassword.' '.$deCryptedPassword.' plainnya: '.$plainPassword."<br>";
       }*/
 }
Exemple #6
0
 function authenticate()
 {
     $exception = null;
     if ($this->_tableName == '') {
         $exception = 'A table must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.';
     } elseif ($this->_identityColumn == '') {
         $exception = 'An identity column must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.';
     } elseif ($this->_credentialColumn == '') {
         $exception = 'A credential column must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.';
     } elseif ($this->_identity == '') {
         $exception = 'A value for the identity was not provided prior to authentication with Zend_Auth_Adapter_DbTable.';
     } elseif ($this->_credential === null) {
         $exception = 'A credential value was not provided prior to authentication with Zend_Auth_Adapter_DbTable.';
     }
     if (null !== $exception) {
         /**
          * @see Zend_Auth_Adapter_Exception
          */
         require_once 'Zend/Auth/Adapter/Exception.php';
         throw new Zend_Auth_Adapter_Exception($exception);
     }
     // create result array
     $authResult = array('code' => Zend_Auth_Result::FAILURE, 'identity' => $this->_identity, 'messages' => array());
     // build credential expression
     if (empty($this->_credentialTreatment) || strpos($this->_credentialTreatment, "?") === false) {
         $this->_credentialTreatment = '?';
     }
     $credentialExpression = new Zend_Db_Expr($this->_zendDb->quoteInto($this->_zendDb->quoteIdentifier($this->_credentialColumn) . ' = ' . $this->_credentialTreatment, $this->_credential) . ' AS zend_auth_credential_match');
     // query for the identity
     try {
         //$resultIdentities = $this->_zendDb->fetchAll('SELECT * FROM '.$this->_tableName.' where '.$this->_identityColumn. "='" .$this->_identity."' AND isActive=1");
         $resultIdentities = $this->_zendDb->fetchAll('SELECT * FROM ' . $this->_tableName . ' ku
          LEFT JOIN gacl_aro_groups gag ON ku.packageId=gag.id
          where ku.' . $this->_identityColumn . "='" . $this->_identity . "' AND ku.isActive IN (1,99)");
     } catch (Exception $e) {
         /**
          * @see Zend_Auth_Adapter_Exception
          */
         require_once 'Zend/Auth/Adapter/Exception.php';
         throw new Zend_Auth_Adapter_Exception('The supplied parameters to Zend_Auth_Adapter_DbTable failed to ' . 'produce a valid sql statement, please check table and column names ' . 'for validity.');
     }
     if (count($resultIdentities) < 1) {
         $authResult['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
         $authResult['messages'][] = 'A record with the supplied identity could not be found.';
         return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
     } elseif (count($resultIdentities) > 1) {
         $authResult['code'] = Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS;
         $authResult['messages'][] = 'More than one record matches the supplied identity.';
         return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
     }
     $resultIdentity = $resultIdentities[0];
     $obj = new Pandamp_Crypt_Password();
     if (true) {
         if (!$obj->matchPassword($this->_credential, $resultIdentity[$this->_credentialColumn])) {
             $authResult['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
             $authResult['messages'][] = 'Supplied credential is invalid.';
             return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
         }
     }
     unset($resultIdentity['zend_auth_credential_match']);
     $this->_resultRow = $resultIdentity;
     $authResult['code'] = Zend_Auth_Result::SUCCESS;
     $authResult['messages'][] = 'Authentication successful.';
     return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
 }
Exemple #7
0
 function resetAction()
 {
     $this->_helper->layout->setLayout('layout-customer-credential');
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $id = $this->_request->getParam('id') ? $this->_request->getParam('id') : '';
     $obj = new Pandamp_Crypt_Password();
     $modelUser = new App_Model_Db_Table_User();
     $row = $modelUser->find($id)->current();
     $newpass = Pandamp_Lib_Formater::randompassowrd();
     $to = $row->email;
     $row->password = $obj->encryptPassword($newpass);
     $subject = "Your new password for Hukumonline.com";
     $message = "Dear {$row->fullName},\n\n";
     $message .= "As you requested, your password has now been reset. Your new details are as follows:\n\n";
     $message .= "Username: "******"\n";
     $message .= "Password: "******"\n\n";
     $message .= "All the best,\n";
     $message .= "Hukumonline.com";
     $config = new Zend_Config_Ini(ROOT_DIR . '/app/configs/mail.ini', 'mail');
     $options = array('auth' => $config->mail->auth, 'username' => $config->mail->username, 'password' => $config->mail->password);
     $transport = new Zend_Mail_Transport_Smtp($config->mail->host, $options);
     $mail = new Zend_Mail();
     $mail->setBodyText($message);
     $mail->setFrom($config->mail->sender->support->email, $config->mail->sender->support->name);
     $mail->addTo($to, $row->fullName);
     $mail->setSubject($subject);
     try {
         $mailTransport = Pandamp_Application::getResource('mail');
         $mail->send($mailTransport);
         $row->save();
     } catch (Zend_Exception $e) {
         echo $e->getMessage();
         die;
     }
 }
 /**	
  * TODO
  * admin sentEmail
  * @param id, uid
  */
 function sentEmailAction()
 {
     $guid = $this->_getParam('guid') ? $this->_getParam('guid') : '';
     $formater = new Pandamp_Core_Hol_User();
     $obj = new Pandamp_Crypt_Password();
     $aclMan = Pandamp_Acl::manager();
     $tblUser = new Pandamp_Modules_Identity_User_Model_User();
     $rowUser = $tblUser->find($guid)->current();
     if ($rowUser->packageId == 26) {
         // Get disc promo
         $disc = $formater->checkPromoValidation('Disc', $aclMan->getGroupIds('member_individual'), $rowUser->promotionId, $rowUser->paymentId);
         // Get total promo
         $total = $formater->checkPromoValidation('Total', $aclMan->getGroupIds('member_individual'), $rowUser->promotionId, $rowUser->paymentId);
         // get mail content
         $mailcontent = $formater->getMailContent('konfirmasi-email-individual');
         // write confirm individual email
         $formater->_writeConfirmIndividualEmail($mailcontent, $rowUser->fullName, $rowUser->username, $obj->decryptPassword($rowUser->password), $rowUser->paymentId, $disc, $total, base64_encode(Pandamp_Lib_Formater::get_user_id($rowUser->username)), $rowUser->email);
     } elseif ($rowUser->packageId == 27) {
         // Get disc promo
         $disc = $formater->checkPromoValidation('Disc', $aclMan->getGroupIds('member_corporate'), $rowUser->promotionId, $rowUser->paymentId);
         // Get total promo
         $total = $formater->checkPromoValidation('Total', $aclMan->getGroupIds('member_corporate'), $rowUser->promotionId, $rowUser->paymentId);
         // get mail content
         $mailcontent = $formater->getMailContent('konfirmasi-email-korporasi');
         // write confirm korporasi email
         $formater->_writeConfirmCorporateEmail($mailcontent, $rowUser->fullName, $rowUser->company, $rowUser->paymentId, $disc, $total, $rowUser->username, base64_encode(Pandamp_Lib_Formater::get_user_id($rowUser->username)), $rowUser->email);
     } else {
         // get mail content
         $mailcontent = $formater->getMailContent('konfirmasi email gratis');
         // write confirm free email
         $aReturn = $aclMan->getGroupData($rowUser->packageId);
         $formater->_writeConfirmFreeEmail($mailcontent, $rowUser->fullName, $rowUser->username, $obj->decryptPassword($rowUser->password), base64_encode(Pandamp_Lib_Formater::get_user_id($rowUser->username)), $rowUser->email, $aReturn[2]);
     }
 }
Exemple #9
0
 public function getalluserAction()
 {
     $this->_helper->layout()->disableLayout();
     //params: $folderGuid,$start,$limit,orderBy
     $r = $this->getRequest();
     //$q = ($r->getParam('q'))? base64_decode($r->getParam('q')) : "1=1";
     $pColumns = array('ku.kopel', 'ku.username', 'ku.company', 'ku.email', 'gag.value', 'kus.status');
     $sWhere = "";
     if ($r->getParam('q')) {
         $q = base64_decode($r->getParam('q'));
         for ($i = 0; $i < count($pColumns); $i++) {
             $sWhere .= $pColumns[$i] . " LIKE '%" . mysql_real_escape_string($q) . "%' OR ";
         }
         $sWhere = substr_replace($sWhere, "", -3);
     } else {
         $sWhere = "1=1";
     }
     $start = $r->getParam('start') ? $r->getParam('start') : 0;
     $limit = $r->getParam('limit') ? $r->getParam('limit') : 0;
     $orderBy = $r->getParam('orderBy') ? $r->getParam('sortBy') : 'firstname';
     $sortOrder = $r->getParam('sortOrder') ? $r->getParam('sortOrder') : ' asc';
     $a = array();
     $obj = new Pandamp_Crypt_Password();
     $tblUser = new App_Model_Db_Table_User();
     //echo $q;die();
     //$rowset = $tblUser->fetchAll($sWhere, 'kopel ASC', $limit, $start);
     $rowset = App_Model_Show_User::show()->fetchUser($sWhere, $start, $limit);
     if (count($rowset) == 0) {
         $a['users'][0]['kopel'] = 'XXX';
         $a['users'][0]['username'] = "******";
         $a['users'][0]['company'] = "";
         $a['users'][0]['group'] = '';
         $a['users'][0]['status'] = '';
     } else {
         $ii = 0;
         foreach ($rowset as $row) {
             $a['users'][$ii]['checkbox'] = "<input type='checkbox' name='kopel[]' id='kopel' value='{$row->kopel}' class='check_me'>";
             $a['users'][$ii]['kopel'] = $row->kopel;
             $a['users'][$ii]['username'] = $row->username;
             $a['users'][$ii]['company'] = $row->company;
             //$a['users'][$ii]['group']= Pandamp_Controller_Action_Helper_UserGroup::userGroup($row->packageId);
             $a['users'][$ii]['group'] = $row->value;
             //$a['users'][$ii]['status']= Pandamp_Controller_Action_Helper_UserStatus::userStatus($row->periodeId);
             $a['users'][$ii]['status'] = $row->status;
             $btn = "";
             $passwd = "";
             $gEx = Pandamp_Controller_Action_Helper_GroupException::groupException(11);
             if (in_array($row->username, $gEx) && Pandamp_Controller_Action_Helper_UserGroup::userGroup($this->_user->packageId) !== "Master") {
                 $btn .= '-';
                 $passwd .= '';
             } else {
                 if (Pandamp_Controller_Action_Helper_IsAllowed::isAllowed('membership', 'all')) {
                     $btn .= "<a href='" . ROOT_URL . '/' . $this->_zl->getLanguage() . '/customer/user/edit/id/' . $row->kopel . "'>edit</a>&nbsp";
                     $btn .= "<a class=\"deleteAction\" rel=\"{$row->kopel}\" href=\"javascript: void(0);\">delete</a>&nbsp";
                     $btn .= "<a class=\"resetAction\" rel=\"{$row->kopel}\" href=\"javascript: void(0);\">reset</a>";
                     //        				$btn .= "<input type=\"button\" name=\"edit\" value=\"Edit\" onclick=\"javascript: window.location.href='".ROOT_URL.'/'.$this->_zl->getLanguage().'/customer/user/edit/id/'.$row->kopel."'\" class=\"form-button\">&nbsp";
                     //        				$btn .= "<input type=\"button\" name=\"delete\" value=\"Delete\" id=\"$row->kopel\" class=\"form-button\" />&nbsp";
                     //        				$btn .= "<input type=\"button\" name=\"reset\" value=\"Reset\" id=\"$row->kopel\" class=\"form-button\" />";
                     if (Pandamp_Controller_Action_Helper_UserGroup::userGroup($this->_user->packageId) == "Master") {
                         if ($this->is_sha1($row->password)) {
                             $password = $row->password;
                         } else {
                             $password = $obj->decryptPassword($row->password);
                         }
                         $passwd .= "<tr><td>&nbsp;</td><td colspan='6' style='color:green;'>password:<a href='" . ROOT_URL . '/' . $this->_zl->getLanguage() . '/customer/user/edit/id/' . $row->kopel . "'>" . $password . "</a> - " . $row->email . "</td></tr>";
                     } else {
                         $passwd .= "";
                     }
                 } else {
                     $btn .= "Edit&nbsp;";
                     $btn .= "Delete&nbsp;";
                     $btn .= "Reset";
                     $passwd .= "";
                 }
             }
             $a['users'][$ii]['action'] = $btn . "<br><div id='kopel_{$row->kopel}'></div>";
             $a['users'][$ii]['passwd'] = $passwd;
             $ii++;
         }
     }
     echo Zend_Json::encode($a);
     die;
 }
 function transformRegister($value)
 {
     if (empty($value['username'])) {
         throw new Zend_Exception("Username empty!");
     }
     $obj = new Pandamp_Crypt_Password();
     $month = $value['month'] ? $value['month'] : '00';
     $day = $value['day'] ? $value['day'] : '00';
     $year = $value['year'] ? $value['year'] : '0000';
     $newArticle = isset($value['newArticle']) ? $value['newArticle'] : '';
     $newRegulation = isset($value['newRegulation']) ? $value['newRegulation'] : '';
     $newWRegulation = isset($value['newWeeklyRegulation']) ? $value['newWeeklyRegulation'] : '';
     $isContact = isset($value['iscontact']) ? $value['iscontact'] : '';
     if ($value['gender'] == 1) {
         $gender = 'L';
     } else {
         if ($value['gender'] == 2) {
             $gender = 'P';
         } else {
             $gender = 'N';
         }
     }
     $data = array('kopel' => $this->generateKopel(), 'username' => $value['username'], 'password' => $obj->encryptPassword($value['password']), 'fullName' => $value['fullname'] ? $value['fullname'] : '', 'birthday' => $year . '-' . $month . '-' . $day, 'phone' => $value['phone'] ? $value['phone'] : '', 'fax' => $value['fax'] ? $value['fax'] : '', 'gender' => $gender, 'email' => $value['email'], 'company' => $value['company'] ? $value['company'] : '', 'address' => $value['address'] ? $value['address'] : '', 'city' => $value['city'] ? $value['city'] : '', 'state' => $value['province'] ? $value['province'] : '', 'countryId' => $value['countryId'] ? $value['countryId'] : '', 'zip' => $value['zip'] ? $value['zip'] : '', 'indexCol' => 0, 'newArticle' => $newArticle == 1 ? 'Y' : 'N', 'weeklyList' => $newWRegulation == 1 ? 'Y' : 'N', 'monthlyList' => $newRegulation == 1 ? 'Y' : 'N', 'packageId' => $value['aro_groups'], 'promotionId' => $value['promotioncode'] ? $value['promotioncode'] : '', 'educationId' => $value['education'] ? $value['education'] : 0, 'expenseId' => $value['expense'] ? $value['expense'] : 0, 'paymentId' => $value['payment'] ? $value['payment'] : 0, 'trialInDays' => $value['trial'] ? $value['trial'] : 0, 'businessTypeId' => $value['businessType'] ? $value['businessType'] : 0, 'periodeId' => 1, 'createdDate' => date('Y-m-d H:i:s'), 'createdBy' => $value['createdBy'], 'isContact' => $isContact == 1 ? 'Y' : 'N', 'notes' => $value['notes']);
     return $data;
 }
Exemple #11
0
 function authenticate()
 {
     $exception = null;
     if ($this->_tableName == '') {
         $exception = 'A table must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.';
     } elseif ($this->_identityColumn == '') {
         $exception = 'An identity column must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.';
     } elseif ($this->_credentialColumn == '') {
         $exception = 'A credential column must be supplied for the Zend_Auth_Adapter_DbTable authentication adapter.';
     } elseif ($this->_identity == '') {
         $exception = 'A value for the identity was not provided prior to authentication with Zend_Auth_Adapter_DbTable.';
     } elseif ($this->_credential === null) {
         $exception = 'A credential value was not provided prior to authentication with Zend_Auth_Adapter_DbTable.';
     }
     if (null !== $exception) {
         /**
          * @see Zend_Auth_Adapter_Exception
          */
         require_once 'Zend/Auth/Adapter/Exception.php';
         throw new Zend_Auth_Adapter_Exception($exception);
     }
     // create result array
     $authResult = array('code' => Zend_Auth_Result::FAILURE, 'identity' => $this->_identity, 'messages' => array());
     // build credential expression
     if (empty($this->_credentialTreatment) || strpos($this->_credentialTreatment, "?") === false) {
         $this->_credentialTreatment = '?';
     }
     $credentialExpression = new Zend_Db_Expr($this->_zendDb->quoteInto($this->_zendDb->quoteIdentifier($this->_credentialColumn) . ' = ' . $this->_credentialTreatment, $this->_credential) . ' AS zend_auth_credential_match');
     // get select
     /*$dbSelect = $this->_zendDb->select();
       $dbSelect->from($this->_tableName, array('*', $credentialExpression))
                ->where($this->_zendDb->quoteIdentifier($this->_identityColumn) . ' = ?', $this->_identity);*/
     // query for the identity
     try {
         //$resultIdentities = $this->_zendDb->fetchAll($dbSelect->__toString());
         //$resultIdentities = $this->_zendDb->fetchAll('Select kud.id, kud.packageId, ku.guid, ku.username, ku.password, ku.picture from '.$this->_tableName.' ku INNER JOIN KutuUserDetail kud ON ku.guid=kud.uid where ku.'.$this->_identityColumn. "='" .$this->_identity."' AND kud.isActive=1 ORDER BY kud.id DESC");
         $resultIdentities = $this->_zendDb->fetchAll('Select guid, kopel, username, password, packageId, picture, isContact from ' . $this->_tableName . ' where ' . $this->_identityColumn . "='" . $this->_identity . "' AND isActive=1");
     } catch (Exception $e) {
         /**
          * @see Zend_Auth_Adapter_Exception
          */
         require_once 'Zend/Auth/Adapter/Exception.php';
         throw new Zend_Auth_Adapter_Exception('The supplied parameters to Zend_Auth_Adapter_DbTable failed to ' . 'produce a valid sql statement, please check table and column names ' . 'for validity.');
     }
     if (count($resultIdentities) < 1) {
         $authResult['code'] = Zend_Auth_Result::FAILURE_IDENTITY_NOT_FOUND;
         $authResult['messages'][] = 'A record with the supplied identity could not be found or Not active.';
         return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
     }
     //        elseif (count($resultIdentities) > 1) {
     //            $authResult['code'] = Zend_Auth_Result::FAILURE_IDENTITY_AMBIGUOUS;
     //            $authResult['messages'][] = 'More than one record matches the supplied identity.';
     //            return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
     //        }
     $resultIdentity = $resultIdentities[0];
     $obj = new Pandamp_Crypt_Password();
     //        print_r(strtoupper(sha1($this->_credential)) ."==". $resultIdentity[$this->_credentialColumn]);exit();
     if (strtoupper(sha1($this->_credential)) == $resultIdentity[$this->_credentialColumn]) {
         $resultIdentity[$this->_credentialColumn] = $obj->encryptPassword($this->_credential);
         $this->_zendDb->update($this->_tableName, $resultIdentity, $this->_identityColumn . "='" . $this->_identity . "'");
         $authResult['code'] = -51;
         //Zend_Auth_Result::FAILURE_UNCATEGORIZED;
         $authResult['messages'][] = 'You account has been updated, please click [Sign in] again';
         return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
     }
     //if(!$this->_httpClient)
     if (true) {
         //if ($resultIdentity['zend_auth_credential_match'] != '1') {
         if (!$obj->matchPassword($this->_credential, $resultIdentity[$this->_credentialColumn])) {
             $authResult['code'] = Zend_Auth_Result::FAILURE_CREDENTIAL_INVALID;
             $authResult['messages'][] = 'Supplied credential is invalid.';
             return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
         }
     }
     unset($resultIdentity['zend_auth_credential_match']);
     $this->_resultRow = $resultIdentity;
     if (false) {
         $authResult['code'] = -51;
         //Zend_Auth_Result::FAILURE_UNCATEGORIZED;
         $authResult['messages'][] = 'You already login';
         return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
     }
     $authResult['code'] = Zend_Auth_Result::SUCCESS;
     $authResult['messages'][] = 'Authentication successful.';
     return new Zend_Auth_Result($authResult['code'], $authResult['identity'], $authResult['messages']);
 }
 function signupAction()
 {
     $this->_helper->layout->setLayout('layout-hukumonlineid-daftar');
     $r = $this->getRequest();
     if ($r->isPost()) {
         $id = $r->getParam('id') ? $r->getParam('id') : '';
         $promotionCode = $r->getParam('promotionCode') ? $r->getParam('promotionCode') : '';
         $package = $r->getParam('paket') ? $r->getParam('paket') : '';
         $fullName = $r->getParam('fullName') ? $r->getParam('fullName') : '';
         $gender = $r->getParam('chkGender') ? $r->getParam('chkGender') : '';
         $month = $r->getParam('month') ? $r->getParam('month') : '';
         $day = $r->getParam('day') ? $r->getParam('day') : '';
         $year = $r->getParam('year') ? $r->getParam('year') : '';
         $education = $r->getParam('education') ? $r->getParam('education') : '';
         $expense = $r->getParam('expense') ? $r->getParam('expense') : '';
         $company = $r->getParam('company') ? $r->getParam('company') : '';
         $businessType = $r->getParam('businessType') ? $r->getParam('businessType') : '';
         $phone = $r->getParam('phone') ? $r->getParam('phone') : '';
         $fax = $r->getParam('fax') ? $r->getParam('fax') : '';
         $payment = $r->getParam('payment') ? $r->getParam('payment') : '';
         $email = $r->getParam('email') ? $r->getParam('email') : '';
         $newArtikel = $r->getParam('newArtikel') ? $r->getParam('newArtikel') : '';
         $newRegulation = $r->getParam('newRegulation') ? $r->getParam('newRegulation') : '';
         $newWRegulation = $r->getParam('newWeeklyRegulation') ? $r->getParam('newWeeklyRegulation') : '';
         $iscontact = $r->getParam('iscontact') ? $r->getParam('iscontact') : '';
         $obj = new Pandamp_Crypt_Password();
         $formater = new Pandamp_Core_Hol_User();
         $aclMan = Pandamp_Acl::manager();
         try {
             for ($x = 1; $x <= $id; $x++) {
                 $username = $r->getParam('username' . $x) ? $r->getParam('username' . $x) : '';
                 $password = $r->getParam('password' . $x) ? $r->getParam('password' . $x) : '';
                 $tblUser = new Pandamp_Modules_Identity_User_Model_User();
                 Zend_Db_Table::getDefaultAdapter()->beginTransaction();
                 $rowUser = $tblUser->fetchNew();
                 $rowUser->username = $username;
                 $rowUser->password = $obj->encryptPassword($password);
                 $rowUser->fullName = $fullName;
                 $rowUser->gender = $gender == 1 ? 'L' : 'P';
                 $rowUser->birthday = $year . '-' . $month . '-' . $day;
                 $rowUser->indexCol = $x;
                 $rowUser->phone = $phone;
                 $rowUser->fax = $fax;
                 $rowUser->email = $email;
                 $rowUser->company = $company;
                 $rowUser->newArticle = $newArtikel == 1 ? 'Y' : 'N';
                 $rowUser->weeklyList = $newWRegulation == "1" ? 'Y' : 'N';
                 $rowUser->monthlyList = $newRegulation == 1 ? 'Y' : 'N';
                 $rowUser->isContact = $iscontact == $x ? 'Y' : 'N';
                 $rowUser->packageId = $package;
                 $rowUser->promotionId = $promotionCode;
                 $rowUser->educationId = $education;
                 $rowUser->expenseId = $expense;
                 $rowUser->paymentId = $payment;
                 $rowUser->businessTypeId = $businessType;
                 $tblNumber = new Pandamp_Modules_Misc_Number_Model_GenerateNumber();
                 $rowset = $tblNumber->fetchRow();
                 $num = $rowset->user;
                 $totdigit = 5;
                 $num = strval($num);
                 $jumdigit = strlen($num);
                 $noinvoice = str_repeat("0", $totdigit - $jumdigit) . $num;
                 $rowset->user = $rowset->user += 1;
                 $tblNumber->update(array('user' => $rowset->user));
                 $rowUser->kopel = $noinvoice;
                 $rowUser->save();
                 Zend_Db_Table::getDefaultAdapter()->commit();
                 $aclMan->addUser($username, 'member_gratis');
             }
             switch ($package) {
                 case 25:
                     $mailcontent = $formater->getMailContent('konfirmasi email gratis');
                     $m = $formater->_writeConfirmFreeEmail($mailcontent, $fullName, $r->getParam('username1'), $r->getParam('password1'), base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email, 'gratis');
                     break;
                 case 26:
                     $disc = $formater->checkPromoValidation('Disc', $aclMan->getGroupIds('member_individual'), $promotionCode, $payment);
                     $total = $formater->checkPromoValidation('Total', $aclMan->getGroupIds('member_individual'), $promotionCode, $payment);
                     $mailcontent = $formater->getMailContent('konfirmasi-email-individual');
                     $m = $formater->_writeConfirmIndividualEmail($mailcontent, $fullName, $r->getParam('username1'), $r->getParam('password1'), $payment, $disc, $total, base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email);
                     break;
                 case 27:
                     $disc = $formater->checkPromoValidation('Disc', $aclMan->getGroupIds('member_corporate'), $promotionCode, $payment);
                     $total = $formater->checkPromoValidation('Total', $aclMan->getGroupIds('member_corporate'), $promotionCode, $payment);
                     $mailcontent = $formater->getMailContent('konfirmasi-email-korporasi');
                     $m = $formater->_writeConfirmCorporateEmail($mailcontent, $fullName, $company, $payment, $disc, $total, $r->getParam('username1'), base64_encode(Pandamp_Lib_Formater::get_user_id($r->getParam('username1'))), $email);
                     break;
             }
             $this->view->message = $m;
         } catch (Zend_Exception $e) {
             Zend_Db_Table::getDefaultAdapter()->rollBack();
             $this->view->message = $e->getMessage();
         }
     }
 }