public function addemail(Email $obj)
 {
     $data = $obj->getdata();
     $sqlEx = $this->sql->insert();
     $sqlEx->into($this->table);
     $sqlEx->values($data);
     $pst = $this->sql->prepareStatementForSqlObject($sqlEx);
     $result = $pst->execute();
     if ($result != null) {
         return TRUE;
     } else {
         return FALSE;
     }
 }
 public function registeremailAction()
 {
     $email = addslashes(trim($this->params()->fromPost('email')));
     $code = $this->rand_string(100);
     $check = $this->getEmailTable()->checkemail($email);
     if ($check) {
         $data = array('code' => $code, 'email' => $email);
         $obj = new Email();
         $obj->exchangeArray($data);
         $this->getEmailTable()->addemail($obj);
         echo 'sucess';
         die;
     } else {
         echo 'error';
         die;
     }
 }