public function updateeditedAction() { global $mySession; $db = new Db(); $this->_helper->layout->setLayout('myaccount'); $cid = $this->getRequest()->getParam('cid'); $this->view->cid = $cid; if ($this->getRequest()->isPost()) { $request = $this->getRequest(); $myform = new Form_Edit(); if ($myform->isValid($request->getPost())) { $dataForm = $myform->getValues(); $myObj = new Launchcampaigndb(); // call to model $data = $myObj->editcampdetails($dataForm, $cid); if ($data == 1) { $mySession->errorMsg = "Data updated successfully"; $this->_redirect('myaccount/activecampaign'); } else { $mySession->errorMsg = "not successfull"; $this->render('activecampaign'); } } else { //echo "else of request is valid"; die; $this->view->myform = $myform; $this->render('edit'); } } else { //echo "else of request is post"; die; $this->_redirect('launchcampaign/edit'); } }
public function emailitAction() { global $mySession; $this->_helper->layout->setLayout('myaccount'); $db = new Db(); $myform = new Form_Emailfriends(); $this->view->myform = $myform; if ($this->getRequest()->isPost()) { $request = $this->getRequest(); $myform = new Form_Emailfriends(); if ($myform->isValid($request->getPost())) { $dataForm = $myform->getValues(); $friendsemailid = explode(",", $dataForm['friendsemailid']); foreach ($friendsemailid as $key1 => $value1) { if (trim($value1) != "") { if (!preg_match('/^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+\\.[a-zA-Z]{2,4}(\\.[a-zA-Z]{2,3})?(\\.[a-zA-Z]{2,3})?$/', trim($value1))) { $mySession->errorMsg = "Enter a valid email address"; $this->_redirect('myaccount/emailfriends'); } } } $myObj = new Launchcampaigndb(); $data = $myObj->emailfriends($dataForm); if ($data == 1) { $mySession->errorMsg = "Email sent to your friends"; $this->_redirect('myaccount/activecampaign'); } } else { $this->view->myform = $myform; $this->render('emailfriends'); } } else { $this->_redirect('myaccount/emailfriends'); } }