Esempio n. 1
0
 public function loginAction()
 {
     global $mySession;
     $db = new Db();
     $this->view->pageHeading = "Login";
     $this->_helper->layout->setLayout('login');
     if ($this->getRequest()->isPost()) {
         $request = $this->getRequest();
         $myform = new Form_Login();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             $chkLogin = $db->runQuery("select * from " . ADMINISTRATOR . " where admin_username='******'admin_username']) . "' and admin_password='******'admin_password'])) . "'");
             if ($chkLogin != "" and count($chkLogin) > 0) {
                 $mySession->adminId = $chkLogin[0]['admin_id'];
                 $this->_redirect('dashboard');
             } else {
                 $mySession->errorMsg = "Invalid username or password.";
                 $this->view->myform = $myform;
                 $this->render('index');
             }
         } else {
             $this->view->myform = $myform;
             $this->render('index');
         }
     } else {
         $this->_redirect('index');
     }
 }
Esempio n. 2
0
 public function indexAction()
 {
     $form = new Form_Login();
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             if ($this->_process($form->getValues())) {
                 // We're authenticated! Redirect to the home page
                 $this->_helper->redirector('index', 'index');
             }
         }
     }
     $this->view->form = $form;
 }
 public function indexAction()
 {
     $form = new Form_Login();
     $request = $this->getRequest();
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             if ($this->_process($form->getValues())) {
                 $role = Zend_Auth::getInstance()->getStorage()->read()->getRole();
                 // We're authenticated! Redirect to the home page depending on role
                 if ($role === 'admin') {
                     $this->_helper->redirector('index', 'federico');
                 } else {
                     $this->_helper->redirector('index', 'users');
                 }
             }
         }
     }
     $this->view->form = $form;
 }
 public function loginAction()
 {
     global $mySession;
     $db = new Db();
     $this->_helper->layout()->setLayout('simplecontent');
     $myformsignup = new Form_Signupdesigned();
     $this->view->myformsignup = $myformsignup;
     if ($this->getRequest()->isPost()) {
         //$abc=$this->getRequest()->getParam('abc');
         $request = $this->getRequest();
         $myform = new Form_Login();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             $qury = $db->runquery("Select * from " . USERS . " where emailid='" . $dataForm['emailid'] . "' AND password='******'pass'] . "'");
             if ($qury != "" and count($qury) > 0) {
                 if ($qury[0]['user_status'] == 1) {
                     $mySession->TeeLoggedID = $qury[0]['user_id'];
                     //$this->_redirect('launchcampaign/index');
                     echo "<script>parent.top.location='" . APPLICATION_URL . "launchcampaign/index';</script>";
                     exit;
                 } else {
                     $mySession->errorMsg = "Your Account is inactivated by admin";
                     $this->_redirect('logindesigned/index');
                 }
             } else {
                 $mySession->errorMsg = "invalid Email Address & Password";
                 $this->_redirect('logindesigned/index');
             }
         } else {
             //$mySession->errorMsg="form not valid";
             $this->view->myform = $myform;
             $this->render('index');
         }
     } else {
         //$mySession->errorMsg="check out";
         $this->_redirect('logindesigned/index');
     }
 }
 public function indexAction()
 {
     // Rate limit the login form by IP address, with a maximum of 10 requests every 5 minutes
     $rateLimit = new Noginn_RateLimit(array('login', $_SERVER['REMOTE_ADDR']), 10, 5);
     $form = new Form_Login();
     if ($rateLimit->exceeded()) {
         // A CAPTCHA is added to the form is the rate limit is exceeded
         $form->addCaptcha();
     }
     if ($this->_request->isPost() && $form->isValid($this->_request->getPost())) {
         // Validate the login
         $values = $form->getValues();
         if ($values['username'] == $this->_username && $values['password'] == $this->_password) {
             // Correct login, continue
             $this->_helper->redirector('account');
         } else {
             // Increment request count for failed login attempts
             $rateLimit->increment();
         }
     }
     $form->setAction($this->_helper->url->url());
     $this->view->form = $form;
     $this->view->rateLimit = $rateLimit;
 }
Esempio n. 6
0
 public function loginedAction()
 {
     global $mySession;
     $db = new Db();
     $this->_helper->layout->setLayout('myaccount');
     $launch = $this->getRequest()->getParam('l');
     $this->view->l = $launch;
     //echo "from launch : ".$launch; die;
     $myformsignup = new Form_Signup();
     $this->view->myformsignup = $myformsignup;
     if ($this->getRequest()->isPost()) {
         //$abc=$this->getRequest()->getParam('abc');
         $request = $this->getRequest();
         $myform = new Form_Login();
         if ($myform->isValid($request->getPost())) {
             $dataForm = $myform->getValues();
             $qury = $db->runquery("Select * from " . USERS . " where emailid='" . $dataForm['emailid'] . "' AND password='******'pass']) . "'");
             //echo "Select * from ".USERS." where emailid='".$dataForm['emailid']."' AND password='******'pass']."'"; die;
             if ($qury != "" and count($qury) > 0) {
                 if ($qury[0]['user_status'] == 1) {
                     if ($qury[0]['active_status'] == 1) {
                         if ($mySession->camptitl != "" && $mySession->showurl != "") {
                             //$mySession->errorMsg ="Login First to launch your campaign";
                             //echo "from launch"; die;
                             $mySession->TeeLoggedID = $qury[0]['user_id'];
                             $this->_redirect('launchcampaign/adddescription/login/login');
                         } elseif ($mySession->save_login_url != '') {
                             //echo "normal login"; die;
                             $mySession->TeeLoggedID = $qury[0]['user_id'];
                             $this->_redirect($mySession->save_login_url);
                         } else {
                             //echo "normal login"; die;
                             $mySession->TeeLoggedID = $qury[0]['user_id'];
                             $this->_redirect('myaccount/profile');
                         }
                     } else {
                         $mySession->errorMsg = "Activate your account by clicking on the link sent to your mail";
                         $this->_redirect('login/index');
                     }
                 } else {
                     $mySession->errorMsg = "Your Account is inactivated by admin";
                     $this->_redirect('login/index');
                 }
             } else {
                 $mySession->errorMsg = "Invalid Email Address & Password";
                 $this->_redirect('login/index');
             }
         } else {
             //$mySession->errorMsg="form not valid";
             $this->view->myform = $myform;
             $this->render('index');
         }
     } else {
         //$mySession->errorMsg="check out";
         $this->_redirect('login/index');
     }
 }