コード例 #1
0
 public function insertProsalon()
 {
     $business = $this->_requestParam('business');
     $timestamp = $this->_requestParam('timestamp');
     $campaign = $this->_requestParam('campaign');
     $sent = $this->_requestParam('sent');
     $read = $this->_requestParam('read');
     $confirmed = $this->_requestParam('confirmed');
     $appointmentDate = $this->_requestParam('appointmentDate');
     $authObj = new Application_Model_Auth();
     $isAuthorized = $authObj->authenticate($this->_requestParam('username'), $this->_requestParam('password'));
     if ($isAuthorized) {
         $sql = sprintf("CALL insert_prosalon('%s',{$timestamp},'%s','%s','%s','%s',{$appointmentDate})", $this->escape($business), $this->escape($campaign), $this->escape($sent), $this->escape($read), $this->escape($confirmed));
         $rs = $this->query($sql);
     }
     if ($this->hasError()) {
         $error = 'Unable to save data to prosalon tb';
         $this->setError($error, $error . ' - ' . $sql . ': ' . $this->getError());
     }
 }
コード例 #2
0
 /**
  * Process an attempted login request.
  * 
  * @access public
  */
 public function processAction()
 {
     // Check if we have a POST request
     if (!$this->request->isPost()) {
         return $this->_helper->redirector('index');
     }
     // Get our form and validate it
     $form = $this->getLoginForm();
     if (!$form->isValid($this->request->getPost())) {
         // Invalid entries
         $this->view->form = $form;
         return $this->render('index');
         // re-render the login form
     }
     // Use our Authenticate model
     $auth = new Application_Model_Auth();
     $post = $form->getValues();
     $username = isset($post['username']) ? $post['username'] : null;
     $password = isset($post['password']) ? $post['password'] : null;
     // Test the credentials
     $result = $auth->authenticate($username, $password);
     if (!$result) {
         // Invalid credentials
         $form->setDescription('Invalid username/password combination.');
         $this->view->form = $form;
         return $this->render('index');
         // re-render the login form
     }
     // If they want to be remembered, set a cookie with their username
     if (isset($_POST['remember'])) {
         setcookie($this->remembermecookie, $username, strtotime('+' . $this->remembermeexpire . ' days'), '/');
     } else {
         // Unset if they previously had it set
         setcookie($this->remembermecookie, null, time() - 3600, '/');
     }
     // Build the user
     $this->user = new Application_Model_User($result);
     //echo "<pre>"; print_r($this->user); exit;
     // now register the user model to the registry
     Zend_Registry::set('user', $this->user);
     // Start a session for this user
     $this->session->create($this->user);
     // Redirect to the landing page
     $this->_helper->redirector('index', 'index');
 }