public function resendActivationCode() { $stmt = "SELECT * FROM\r\n\t \t{{merchant}}\r\n\t \tWHERE\r\n\t \tactivation_token='" . $this->data['token'] . "'\r\n\t \tLIMIT 0,1\r\n\t \t"; if ($res = $this->rst($stmt)) { // send email activation key $tpl = EmailTPL::merchantActivationCode($res[0]); $sender = Yii::app()->functions->getOptionAdmin('website_contact_email'); $to = $res[0]['contact_email']; if (!sendEmail($to, $sender, Yii::t("default", "Merchant Registration"), $tpl)) { $this->details = "failed"; } else { $this->details = "ok mail"; } $this->code = 1; $this->msg = Yii::t("default", "We have sent the activation code to your email address."); } else { $this->msg = Yii::t("default", "Token is invalid."); } }
public function merchantSignUp2() { $status = Yii::app()->functions->getOptionAdmin('merchant_sigup_status'); $token = md5($this->data['restaurant_name'] . date('c')); $percent = Yii::app()->functions->getOptionAdmin('admin_commision_percent'); $params = array('restaurant_name' => $this->data['restaurant_name'], 'restaurant_phone' => $this->data['restaurant_phone'], 'contact_name' => $this->data['contact_name'], 'contact_phone' => $this->data['contact_phone'], 'contact_email' => $this->data['contact_email'], 'street' => $this->data['street'], 'city' => $this->data['city'], 'post_code' => $this->data['post_code'], 'cuisine' => json_encode($this->data['cuisine']), 'username' => $this->data['username'], 'password' => md5($this->data['password']), 'status' => $status, 'date_created' => date('c'), 'ip_address' => $_SERVER['REMOTE_ADDR'], 'activation_token' => $token, 'activation_key' => Yii::app()->functions->generateRandomKey(5), 'restaurant_slug' => Yii::app()->functions->createSlug($this->data['restaurant_name']), 'payment_steps' => 3, 'country_code' => $this->data['country_code'], 'state' => $this->data['state'], 'is_commission' => 2, 'percent_commision' => $percent, 'abn' => isset($this->data['abn']) ? $this->data['abn'] : ''); if (!Yii::app()->functions->validateUsername($this->data['username'])) { if ($respck = Yii::app()->functions->validateMerchantUserFromMerchantUser($params['username'], $params['contact_email'])) { $this->msg = $respck; return; } if ($this->insertData("{{merchant}}", $params)) { $this->code = 1; $this->msg = Yii::t("default", "Successful"); $this->details = $token; // send email activation key $tpl = EmailTPL::merchantActivationCode($params); $sender = Yii::app()->functions->getOptionAdmin('website_contact_email'); $to = $this->data['contact_email']; if (!sendEmail($to, $sender, "Merchant Registration", $tpl)) { //$this->details="failed"; } //else $this->details="ok mail"; } else { $this->msg = Yii::t("default", "Sorry but we cannot add your information. Please try again later"); } } else { $this->msg = Yii::t("default", "Sorry but your username is alread been taken."); } }