Example #1
0
 public function actionSend_sms()
 {
     if (Yii::app()->user->isGuest) {
         Yii::app()->user->loginRequired();
     }
     $sms = new Sendsms();
     if (isset($_POST['Sendsms'])) {
         $sms->attributes = $_POST['Sendsms'];
         $smsobj = new SmsApi();
         $user_id->user_organization_id;
         $r = $smsobj->sendsms($sms->phone_no, $sms->message, $org);
         if (preg_match('/alert_/', $r)) {
             echo 'sent';
         }
     }
     $this->render('send_sms', array('model' => $sms));
 }
	public function actionBackgroundmsg($phone_nos,$msg)
	{
		$count = count($phone_nos);

		Yii::import('application.extensions.runactions.components.ERunActions');
			
		//require_once "Mail.php";

		if (ERunActions::runBackground()) {
			$output = implode(",",$phone_nos);
			$smsobj=new SmsApi;
			$r=$smsobj->sendsms($output,$msg);
				if(preg_match('/alert_/',$r))
					echo 'sent';
				
			}
		else
		{
			$this->redirect(array('admin'));
		}
	}
 public function actionForgotpassword()
 {
     $this->layout = 'login_layout';
     $model = new LoginForm();
     if (isset($_POST['LoginForm'])) {
         $model->attributes = $_POST['LoginForm'];
         $user_id = User::model()->findByAttributes(array('user_organization_email_id' => $model->username));
         //var_dump($user_id); exit;
         if (!empty($user_id)) {
             $random = substr(number_format(time() * rand(), 0, '', ''), 0, 10);
             $phone_no = 0;
             $check_user = StudentTransaction::model()->find('student_transaction_user_id =' . $user_id->user_id);
             if (!empty($check_user)) {
                 $phone_no = StudentInfo::model()->findByPk($check_user->student_transaction_student_id)->student_mobile_no;
             }
             $check_user_emp = EmployeeTransaction::model()->find('employee_transaction_user_id =' . $user_id->user_id);
             if (!empty($check_user_emp)) {
                 $phone_no = EmployeeInfo::model()->findByPk($check_user_emp->employee_transaction_employee_id)->employee_private_mobile;
             }
             if ($phone_no != 0) {
                 $smsobj = new SmsApi();
                 $org = $user_id->user_organization_id;
                 $r = $smsobj->sendsms($phone_no, $random, $org);
                 if (preg_match('/alert_/', $r)) {
                     $update_user = User::model()->findByPk($user_id->user_id);
                     $update_user->user_password = md5($random . $random);
                     $update_user->save();
                     $this->redirect(array('smsNotification', 'status' => 'success'));
                 } else {
                     $this->redirect(array('smsNotification', 'status' => 'getway-error'));
                 }
             }
             $this->redirect(array('smsNotification', 'status' => 'user_not_exist'));
         } else {
             $this->redirect(array('smsNotification', 'status' => 'user_not_exist'));
         }
     }
     $this->render('forgotpassword', array('model' => $model));
 }