示例#1
0
 public function actionDelete()
 {
     $id = $this->_get('id');
     $user_id = $this->_get('user_id');
     $obj = User::model()->findByPk($user_id);
     if ($id && Report::model()->deleteByPk($id)) {
         $mobile = $obj->mobile;
         if (isset($mobile) && $mobile) {
             // $type =='register','forget',
             $sms = new Sms();
             $result = $sms->sendSMS($mobile, '您好,你的反馈我们已近收到,我们将尽快处理,Urtime谢谢你的宝贵意见', 'true');
             $result = $sms->execResult($result);
             if ($result[1] == 0) {
                 // echo '发送成功';
                 Yii::app()->user->setFlash('send', 1);
                 $this->redirect(array('report/index'));
             } else {
                 //echo "发送失败{$result[1]}";
                 Yii::app()->user->setFlash('send', 0);
                 $this->redirect(array('report/index'));
             }
         } else {
             Yii::app()->user->setFlash('report', 0);
             $this->redirect(array('report/index'));
         }
     } else {
         Yii::app()->user->setFlash('report', 0);
         $this->redirect(array('report/index'));
     }
 }
示例#2
0
 public function sms()
 {
     //注册时发送的验证码
     vendor('Sms.Sms');
     $phone = $_POST["username"];
     $method = $_POST["method"];
     /*$rules=array(
     			array('username','','手机号已经存在!',0,'unique',1), // 在新增的时候验证name字段是否唯一
     		);
     		*/
     $user = M("user_manage");
     //检查手机号的合法性
     if (preg_match("/1[34578]{1}\\d{9}/", $phone)) {
         //$result=;
         //isset($result));
         if ($method == "lostpass") {
             //找回密码
             if ($user->where("username={$phone} and state=1")->find()) {
                 $verify = rand(1000, 9999);
                 vendor('Msg.msg');
                 $msg = new \msg(M());
                 $m = $msg->createMsg(0, 'repass', array('validNum' => $verify));
                 //$m="您的验证码为$verify";
                 $sms = new \Sms();
                 $tag = $sms->sendSMS($phone, $m);
                 if ($tag == 1) {
                     //数据库中改手机号已经注册,但未注册成功
                     $data["validity"] = time();
                     $data["verify"] = $verify;
                     $user->where("username={$phone}")->save($data);
                 }
                 echo $tag;
             } else {
                 echo "手机号未注册";
             }
         } else {
             //首次注册
             //检查手机号是否注册成功
             if ($user->where("username={$phone} and state=1")->find()) {
                 echo "手机号已经注册";
             } else {
                 $verify = rand(1000, 9999);
                 vendor('Msg.msg');
                 $msg = new \msg(M());
                 $m = $msg->createMsg(0, 'login', array('validNum' => $verify));
                 $sms = new \Sms();
                 $tag = $sms->sendSMS($phone, $m);
                 if ($tag == 1) {
                     $result = $user->where("username={$phone} and state=1")->find();
                     if ($result) {
                         //数据库中改手机号已经注册,但未注册成功
                         $data["validity"] = time();
                         $data["verify"] = $verify;
                         $user->where("username={$phone}")->save($data);
                     } else {
                         //数据库改手机号未注册过
                         $data["username"] = $phone;
                         $data["state"] = 0;
                         $data["verify"] = $verify;
                         $data["validity"] = time();
                         $user->add($data);
                     }
                 }
                 echo $tag;
             }
         }
     } else {
         echo "您的手机号码不合法";
     }
 }
示例#3
0
    $roles = "商户管理员,管理商户编号为" . $shop;
}
//发送短信通知
if ($role == 1) {
    $sql = "select msgContext from msgModule where catID=0 and catName='addadmin'";
} else {
    if ($role == 2) {
        $sql = "select msgContext from msgModule where catID=0 and catName='addmall'";
    } else {
        $sql = "select msgContext from msgModule where catID=0 and catName='addshop'";
    }
}
$msgresult = mysql_query($sql);
$row = mysql_fetch_array($msgresult);
$sms = new Sms();
$sms->sendSMS($phone, $row["msgContext"]);
//发送邮件通知
if ($role == 1) {
    $sql = "select msgContext from msgModule where catID=1 and catName='addadmin'";
} else {
    if ($role == 2) {
        $sql = "select msgContext from msgModule where catID=1 and catName='addmall'";
    } else {
        $sql = "select msgContext from msgModule where catID=1 and catName='addshop'";
    }
}
$msgresult = mysql_query($sql);
$row = mysql_fetch_array($msgresult);
$system_info_result = mysql_query("select * from system_info");
$system_info = mysql_fetch_array($system_info_result);
$smtp_info = explode("@", $system_info["email"]);