public function sms()
 {
     $model = M('Sms_mb');
     $mb = $model->where('model="Student"')->find();
     if ($mb) {
         $map['id'] = array('in', $_POST['ids']);
         $name = $this->getActionName();
         $model = M($name);
         $vo = $model->where($map)->select();
         if ($vo > getSmsNum()) {
             $this->error('您的短信剩余条数不足以完成本次发送,剩余条数' . getSmsNum());
         } else {
             foreach ($vo as $key => $value) {
                 $name = getStudentinfo($value['id'], 'nickname');
                 $xuehao = getStudentinfo($value['id'], 'account');
                 $class = getClass(getStudentinfo($value['id'], 'class_id'));
                 $gender = getStudentinfo($value['id'], 'gender');
                 $tel = getStudentinfo($value['id'], 'tel');
                 $content = str_replace('{name}', $name, $mb['content']);
                 $content = str_replace('{xuehao}', $xuehao, $content);
                 $content = str_replace('{class}', $class, $content);
                 $content = str_replace('{gender}', $gender, $content);
                 $content = str_replace('{tel}', $tel, $content);
                 sendSms($tel, $content);
             }
             $this->success('发送成功!');
         }
     } else {
         $this->error('请先设置模板');
     }
 }
示例#2
0
 public function sendnotification()
 {
     error_reporting(0);
     $absencenotify = $this->input->post('absencenotify', true);
     $message = $this->input->post('message', true);
     foreach ($absencenotify as $absencenot) {
         $absencesep = explode("_", $absencenot);
         $stdid = $absencesep[0];
         $contact = $absencesep[1];
         $currentDate = date('m/d/Y');
         //echo $currentDate;
         if ($absencesep) {
             $s[] = array('studentabid' => $stdid, 'absencedate' => $currentDate);
             sendSms($message, $contact);
         }
     }
     $res = $this->common_model->insertBatch($this->common_model->_absence, $s);
     if ($res) {
         $this->status['status'] = 1;
         $this->status['msg'] = "Absence Notifyer Worked Fine";
     } else {
         $this->status['status'] = 0;
         $this->status['msg'] = "There is no student in this group. Please add student in this group.";
     }
     echo jsonEncode($this->status);
 }
示例#3
0
 /**
  * 发送注册验证短信
  * @param unknown $mobile
  */
 public function sendVirifySms($mobile)
 {
     // 验证该手机号是否已经被注册
     $where = array('mobile' => $mobile);
     $user_info = D('User')->where($where)->find();
     if ($user_info) {
         throw new RadaException('该手机号已经被注册');
     }
     $code = makeRandomString(6, 'number');
     $content = sprintf('你的注册验证码是$d', $code);
     $res = sendSms($mobile, $content);
     if (!$res) {
         throw new RadaException('发送短信失败,请重试');
     }
     // redis记录验证码
     $redis = getRedisEx('USER_CACHE');
     $data = array('mobile' => $mobile, 'code' => $code, 'ctime' => NOW_TIME);
     $redis->setex(self::USER_REGISTER_SMS_PRIFIX . $mobile, 600, json_encode($data));
     return true;
 }
示例#4
0
文件: index.php 项目: vocxod/industix
 // The response from reCAPTCHA
 $resp = null;
 // The error code from reCAPTCHA, if any
 $error = null;
 $reCaptcha = new ReCaptcha($secret);
 // Was there a reCAPTCHA response?
 if ($app->request->params("g-recaptcha-response")) {
     $resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $app->request->params("g-recaptcha-response"));
     if ($resp != null && $resp->success) {
         $twig_vars['order_success'] = "1";
         // @todo
         //Send SMS to our phone(s)
         // var_dump('send SMS');
         // redirect to /:city/order/success page
         $smsText = "Заказ. Тел:" . $_POST['customer_phone'] . " Имя:" . $_POST['customer_name'] . " Aдрес:" . $_POST['customer_address'] . " Работа:" . substr(trim($_POST['customer_job']), 0, 128);
         $result = sendSms($smsText, "9626852178");
         //$result = sendSms( $smsText, "9811714272" );
         $app->redirect('/spb/order/success');
     } else {
         $twig_vars['order_success'] = '2';
         // captcha not valid
     }
 }
 // end GOOGLE CAPTCHA
 $slug = "quickorderspb";
 $config = $twig_vars['config'];
 if ($slug == "index") {
     $app->redirect($config['url']);
 }
 if (isset($twig_vars['pages'][$slug])) {
     $page = $twig_vars['pages'][$slug];
    $content = '您的验证码为: [code], 任何人索取验证码均为咋骗,切勿泄露!此验证码会在15分钟后失效';
    $code = mt_rand(100000, 999999);
    Sp_Sendmsg::send(array('type' => Sp_Dictionary::getSmsType(0), 'username' => $phone, 'code' => $code, 'content' => str_replace('[code]', $code, $content)));
    return true;
}
$jsonParam = array();
$request = Request::current();
$phone = $request->phone;
// 获得手机号
$rs = checkPhone($phone);
if (is_array($rs)) {
    $jsonParam = $rs;
} else {
    // 获取短信验证码
    if ('getcode' == $request->type) {
        sendSms($phone);
        $jsonParam = array('code' => '200', 'msg' => '短信发送成功');
    } else {
        // 登陆
        $code = $request->code;
        $rs = checkLogin($code, $phone);
        if (is_array($rs)) {
            $jsonParam = $rs;
        } else {
            $user = Sp_Account_SignIn::getUserByPhone($phone);
            $jsonParam = array('code' => '200', 'msg' => '登录成功', 'uid' => $user['id']);
        }
    }
}
header('Content-type: application/json;charset=utf-8');
echo json_encode($jsonParam);
示例#6
0
        $mobile_tech = "";
        // remove everything except numbers
        $mobile_tech = preg_replace('/\\D/', '', $mobile);
        // +49 (0) 177 - 2563235 -> 4901772563235
        // remove leading "0" and/or leading "49"
        $mobile_tech = ltrim($mobile_tech, "0");
        // 004901772563235 -> 4901772563235
        $mobile_tech = ltrim($mobile_tech, "49");
        // 4901772563235 -> 01772563235
        $mobile_tech = ltrim($mobile_tech, "0");
        // 01772563235 -> 1772563235
        // check for already used number
        if (usedMobile($mobile_tech)) {
            $error[] = 4;
        } else {
            $success = $sended = sendSms($mobile_tech, $location, $name);
            if ($sended) {
                $success = true;
                $mobile = "";
                $name = "";
                $terms = 0;
            } else {
                $error[] = 5;
            }
        }
    }
}
?>
<!DOCTYPE html>
<html lang="en">
  <head>
 /**
  * 验证码
  */
 public function validate_code()
 {
     if ($this->isPost() || $this->isAjax()) {
         $phone = isset($_POST['phone']) ? trim($_POST['phone']) : $this->redirect('/');
         $type = isset($_POST['type']) ? intval($_POST['type']) : null;
         if (empty($phone) || !in_array($type, array(1, 2, null))) {
             $this->ajaxReturn(array('status' => 0, 'result' => '参数错误'));
         }
         if ($type == 1 || is_null($type)) {
             if (M('Member')->where(array('phone' => $phone))->count()) {
                 $this->ajaxReturn(array('status' => 0, 'result' => '该手机已注册,请直接登陆'));
             }
         }
         $validate_code = rand(1000, 9999);
         if (sendSms($phone, "您好,您的验证码是{$validate_code}【鲜果送】")) {
             $this->ajaxReturn(array('status' => 1, 'result' => $validate_code));
         } else {
             $this->ajaxReturn(array('status' => 0, 'result' => '未知错误'));
         }
     } else {
         $this->redirect('/');
     }
 }
示例#8
0
 public function sendsms()
 {
     $id = $_REQUEST['id'];
     $name = getStudentinfo($id, 'nickname');
     $xuehao = getStudentinfo($id, 'account');
     $class = getClass(getStudentinfo($id, 'class_id'));
     $gender = getStudentinfo($id, 'gender');
     $tel = getStudentinfo($id, 'tel');
     $content = $_REQUEST['content'];
     $content = str_replace('{name}', $name, $content);
     $content = str_replace('{xuehao}', $xuehao, $content);
     $content = str_replace('{class}', $class, $content);
     $content = str_replace('{gender}', $gender, $content);
     $content = str_replace('{tel}', $tel, $content);
     $num = sendSms($tel, $content);
     if ($num == '1') {
         $this->success("发送成功");
     } else {
         $this->error("发送失败,错误代码为" . $num);
     }
 }
示例#9
0
 public function getVerifyCode()
 {
     $this->check_login();
     $this->check_user();
     $way = filtStr($_POST['way']);
     $target = filtStr($_POST['target']);
     $db = M('shop');
     $where = 'uid=' . $this->user['id'];
     if (!$target || !$way) {
         $data['info'] = '填写信息不全';
         $this->ajaxReturn($data);
     }
     $verifyCode = getRandStr(6);
     $save[$way] = $verifyCode;
     $msg = '您的验证码:' . $verifyCode;
     if ($way == 'mobile') {
         if (!checkIsMobile($target)) {
             $data['info'] = '手机号格式错误';
             $this->ajaxReturn($data);
         }
         if (sendSms($msg, $target, $setting)) {
             $db->where($where)->save($save);
             $data['info'] = '验证码发送成功';
         } else {
             $data['info'] = '验证码发送失败';
         }
     } else {
         if ($way == 'email') {
             if (!checkIsEmail($target)) {
                 $data['info'] = '邮箱格式错误';
                 $this->ajaxReturn($data);
             }
             $send_result = sp_send_email($target, "邮箱认证", $msg);
             if ($send_result['error']) {
                 $data['info'] = '验证码发送失败';
             } else {
                 $data['info'] = '验证码发送成功';
             }
         } else {
             $data['info'] = "非法请求";
         }
     }
     M('shop')->where('uid=' . $this->user['id'])->setField($way, $verifyCode);
     $this->ajaxReturn($data);
 }
 public function createSchedule()
 {
     if (!empty($_POST['taskdate']) && !empty($_POST['cid']) && !empty($_POST['empid'])) {
         $thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $_POST['cid']));
         $thisemployee = Employee::find_by_id((int) preg_replace('#[^0-9]#i', '', $_POST['empid']));
         $thisSchedule = new Schedule();
         $thisSchedule->emp_id = $_POST['empid'];
         $thisSchedule->emp_name = $thisemployee->emp_fname . " " . $thisemployee->emp_lname;
         $thisSchedule->client_id = "   ";
         $thisSchedule->prod_id = $_POST['cid'];
         $thisSchedule->prod_name = $thisclientproduct->prod_name;
         $thisSchedule->s_date = $_POST['taskdate'];
         //$thisSchedule->s_time_in       ;
         //$thisSchedule->s_time_out;
         $thisSchedule->issue = $_POST["tissue"];
         $thisSchedule->datecreated = date("Y-m-d H:i:s");
         $thisSchedule->maint_type = $_POST['mtype'];
         $msg = "Maintenance task alert for {$thisclientproduct->prod_name} at";
         $msg .= $thisclientproduct->install_location . "," . $thisclientproduct->branch;
         $msg .= "\r\n issue:" . $_POST["tissue"];
         if ($thisSchedule->create()) {
             sendSms($thisemployee->emp_phone, $msg);
             return true;
         } else {
             return false;
         }
     }
 }
示例#11
0
 public function postSendInvite($id, Request $request)
 {
     set_time_limit(0);
     ignore_user_abort(true);
     $this->projectId = $id = (int) $id;
     if (!$this->getProjectPermission('setting')) {
         return response()->json(['status' => false, 'message' => '没有权限进行此操作']);
     }
     $inviteId = intval($request->input('invite_id'));
     $invite = ProjectInvite::find($inviteId);
     if (!$invite || $invite->project_id != $id) {
         return response()->json(['status' => false, 'message' => '没有找到邀请记录']);
     }
     if ($invite->invited_user_phone && !$invite->send_phone_at->getTimestamp()) {
         require app_path('Services/Taobao/TopSdk.php');
         if ($invite->invited_user_id) {
             $tpl = 'invite_registered';
             $vars = ['name' => $invite->invited_user->realname, 'inviter' => $invite->user->realname, 'project_name' => $invite->project->name];
         } else {
             $tpl = 'invite_anonymous';
             $vars = ['inviter' => $invite->user->realname, 'link' => url('p-' . $invite->project->id . '/' . $invite->invite_code), 'project_name' => $invite->project->name];
         }
         $status = sendSms($tpl, $invite->invited_user_phone, $vars);
         $invite->send_phone_at = time();
     }
     if ($invite->invited_user_email && !$invite->send_email_at->getTimestamp()) {
         $view = 'project.invite_mail';
         $status = \Mail::send($view, ['invite' => $invite], function ($message) use($invite) {
             $message->to($invite->invited_user_email);
             $message->subject('[积木] ' . $invite->user->realname . '邀请你加入' . $invite->project->name);
         });
         $invite->send_email_at = time();
     }
     $invite->save();
 }
示例#12
0
 public function postSendVerify($type = null, RateLimiter $rateLimiter)
 {
     $request = request();
     $response = response();
     if (!$type) {
         $type = $request->input('type');
     }
     if ($type != 'register' && $type != 'forgot_password') {
         $response->json(['status' => false, 'message' => '发送失败,Type参数错误!']);
     }
     $identifier = $request->input('identifier');
     if (!is_email($identifier) || strlen($identifier) > 64) {
         if (!is_phone($identifier)) {
             return $response->json(['status' => false, 'message' => '请输入正确的手机号或邮箱']);
         }
         $verifyType = 'phone';
     } else {
         $verifyType = 'email';
     }
     // 60秒发送一次
     $sessionKey = 'send_verify_last_time';
     $sessionKey .= ".{$type}.{$verifyType}";
     $sessionValue = session($sessionKey);
     $currentTime = time();
     if ($sessionValue && $sessionValue + 60 > $currentTime) {
         return $response->json(['status' => false, 'message' => '发送失败,请不要频繁获取验证码']);
     }
     // 一个IP一个小时可以发送20次
     $rateLimiterKey = 'send_verify_rate_limiter';
     $rateLimiterKey .= ":{$type}:{$verifyType}_" . request()->ip();
     if ($rateLimiter->tooManyAttempts($rateLimiterKey, 60, 20)) {
         return $response->json(['status' => false, 'message' => '当前网络环境获取已达上限,请一小时后再试']);
     }
     if ($type == 'register') {
         if (User::hasBeenUsed($verifyType, $identifier, true)->exists()) {
             $verifyTypeName = $verifyType == 'phone' ? '手机号' : '邮箱';
             $loginUrl = url('account/login', [$identifier]);
             $forgotPasswordUrl = url('account/forgot-password', [$identifier]);
             return $response->json(['status' => false, 'message' => '此' . $verifyTypeName . '已被注册,你可以 <a href="' . $loginUrl . '">尝试登陆</a> 或 <a href="' . $forgotPasswordUrl . '">找回密码</a>']);
         }
     } elseif ($type == 'forgot_password') {
         if (!User::hasBeenUsed($verifyType, $identifier, false)->exists()) {
             $verifyTypeName = $verifyType == 'phone' ? '手机号' : '邮箱';
             $createUrl = url('account/create', [$identifier]);
             return $response->json(['status' => false, 'message' => '此' . $verifyTypeName . '还没注册,<a href="' . $createUrl . '">现在去注册</a>']);
         }
     }
     $code = rand(100000, 999999);
     $value = ['type' => $type, 'code' => $code, 'identifier' => $identifier, 'verify_type' => $verifyType, 'attempt' => 0];
     $cacheKey = md5("send_verify_detail.{$type}.{$identifier}" . config('key'));
     if ($verifyType == 'phone') {
         require app_path('Services/Taobao/TopSdk.php');
         $status = sendSms($type . '_verify', $identifier, ['code' => $code, 'product' => '积木']);
     } elseif ($verifyType == 'email') {
         $action = $type == 'register' ? 'create' : 'forgot-password';
         $vars = ['email' => $identifier, 'code' => $code, 'link' => url('account/' . $action) . '?key=' . urlencode($cacheKey)];
         $view = 'user.account.' . $type . '_verify_mail';
         $subject = $type == 'register' ? '[积木] 账户注册验证码' : '[积木] 账户密码找回验证码';
         $status = \Mail::send($view, $vars, function ($message) use($identifier, $subject) {
             $message->to($identifier);
             $message->subject($subject);
         });
     }
     if (empty($status)) {
         $status = false;
     } else {
         Cache::put($cacheKey, $value, 60);
         session([$sessionKey => $currentTime]);
         $rateLimiter->hit($rateLimiterKey);
     }
     $typeName = $verifyType == 'phone' ? '短信' : '邮件';
     return $response->json(['status' => (bool) $status, 'message' => $status ? '' : 'Oh. 验证' . $typeName . '发送失败,请稍后重试']);
 }
 public function createSchedule_Detail($id = "")
 {
     header('Content-Type: application/json');
     $data = json_decode(stripslashes($_POST['data']));
     foreach ($data as $d => $value) {
         $cntdata[] = $d;
     }
     if (!empty($data->taskdate) && !empty($data->cid) && !empty($data->empid)) {
         $issuefield = get_object_vars($data);
         // get the properties of an object into an array
         $thisclientproduct = Cproduct::find_by_id((int) preg_replace('#[^0-9]#i', '', $data->cid));
         $thisemployee = Employee::find_by_id((int) preg_replace('#[^0-9]#i', '', $data->empid));
         $thisSchedule = new Schedule();
         $thisSchedule->emp_id = $issuefield['empid'];
         $thisSchedule->emp_name = $thisemployee->emp_fname . " " . $thisemployee->emp_lname;
         $thisSchedule->client_id = $thisclientproduct->client_id;
         $thisClient = Client::find_by_id($thisclientproduct->client_id);
         //print_r($thisclientproduct);
         //print_r($thisClient);
         //print_r($thisemployee);
         $thisSchedule->prod_id = $issuefield['cid'];
         $thisSchedule->prod_name = $thisclientproduct->prod_name;
         /**
          * this is to check if ticket
          * is in existence
          */
         //print_r($theUser);
         global $session;
         //$partTicket                             =   ($id!="") ? Ticket::find_by_id($id) : ""; // get the ticket to get details needed for sending mail
         $theUser = Employee::find_by_id($_SESSION["emp_ident"]);
         // get cse detail to retrieve email
         $thisSchedule->s_date = $data->taskdate;
         /**
          * section to configure and setup sms and email message 
          */
         $issue = array();
         $objIssue = Issue::find_all();
         // creating the issue log object
         $message_issue = "";
         //$thisemployee->emp_phone
         foreach ($objIssue as $objI) {
             foreach ($issuefield as $key => $value) {
                 if ($key == $objI->issue_accronym) {
                     $message_issue .= $objI->issue_name . ", ";
                 }
             }
         }
         $cemail = array();
         $cemail = isset($_POST['cemail']) && !empty($_POST['cemail']) ? explode(",", $_POST['cemail']) : array('*****@*****.**');
         array_push($cemail, $thisemployee->emp_email, is_array($partTicket) ? $partTicket->contact_email : "", $theUser->emp_email, $thisClient->email);
         //print_r($cemail);
         $thisSchedule->status = "Open";
         $thisSchedule->issue = $message_issue;
         $thisSchedule->datecreated = date("Y-m-d H:i:s");
         $thisSchedule->maint_type = $_POST['mtype'];
         $subject = "Maintenance Alert";
         $smsmsg = "Maintenance alert for {$thisclientproduct->prod_name} at";
         $smsmsg .= $thisclientproduct->install_location . "," . $thisclientproduct->branch;
         $smsmsg .= "\r\n Issue:" . $message_issue . "\r\n";
         $smsmsg .= "\r\n Comment:" . $issuefield["tissue"] . "\r\n";
         $msg = "<h3>Maintenance Detail</h3> <hr />";
         $msg .= "<p><strong>Machine: </strong>{$thisclientproduct->prod_name} </p>";
         $msg .= "<p><strong>Client: </strong> {$thisClient->name}</p>";
         $msg .= "<p><strong>Location: </strong>{$thisclientproduct->install_location} {$thisclientproduct->branch} {$thisclientproduct->install_city} </p>";
         $msg .= "<p><strong>Issues: </strong>" . $message_issue . "</p>";
         $msg .= "<p><strong>Comment: </strong>" . $issuefield["tissue"] . "</p>";
         $msg .= "<br /><br /> <h4>Technician Details</h4> <hr />";
         $msg .= "<p><strong>Name: </strong>" . $thisemployee->emp_fname . " " . $thisemployee->emp_lname . "</p>";
         $msg .= "<p><strong>Email: </strong>" . $thisemployee->emp_email . "</p>";
         $msg .= "<p><strong>Telephone: </strong>" . $thisemployee->emp_phone . "</p>";
         $msg .= "<br /><br /><h4>Scheduled Date</h4> <hr />";
         $msg .= "<p><strong>{$thisSchedule->s_date}</strong></p><br /><br /><br /><br />";
         /**
          * the transaction log is created
          * to ensure that the product already 
          * has history and cannot be deleted
          */
         $Tlog2 = new Transaction();
         $Tlog2->com_id = $thisclientproduct->main_id;
         $Tlog2->trans_type = "TASK ASSIGNMENT";
         $Tlog2->trans_description = $issuefield["mtype"] . " task assigned to " . $thisemployee->emp_fname . " " . $thisemployee->emp_lname . "";
         $Tlog2->datecreated = date("Y-m-d H:i:s");
         $Tlog2->user_id = $_SESSION['emp_ident'];
         // print_r($msg);
         if ($thisSchedule->create()) {
             $Tlog2->create();
             /**
              * this section is needed
              * to post issues to database table
              * issuelog for statistical analysis on
              * issues
              */
             //$thisemployee->emp_phone
             foreach ($objIssue as $objI) {
                 foreach ($issuefield as $key => $value) {
                     if ($key == $objI->issue_accronym) {
                         $issueLog = new Issuelog();
                         $issueLog->ticket_id = 0;
                         $issueLog->issue_id = $objI->id;
                         $issueLog->issue_accronym = $objI->issue_accronym;
                         $issueLog->issue_name = $objI->issue_name;
                         $issueLog->prod_id = $issuefield['cid'];
                         $issueLog->datecreated = date("Y-m-d H:i:s");
                         //$ddticket->subject				.=	$_POST[$objI->issue_accronym]. ", ";
                         $issueLog->create();
                     }
                 }
             }
             sendSms($thisemployee->emp_phone, $smsmsg);
             //method in function.php in the library folder helps to send sms
             $this->sendMail($thisSchedule->emp_name, $subject, $msg, $cemail);
             // sends email to employee
             return 1;
         } else {
             return 2;
         }
     }
 }
function NK_attendance_create()
{
    require_once ROOTDIR . DS . 'function' . DS . 'loadCSS.php';
    //  $mailer = new PHPMailer;
    global $wpdb;
    $date = date("Y-m-d");
    $rowsLesson = $wpdb->get_results("SELECT subject, lesson, sub.name\n                                       FROM school_scheduler as sch\n                                       LEFT JOIN school_subjects as sub\n                                       ON sch.subject = sub.id\n                                       WHERE subject_date = '{$date}'");
    $rowsStudent = $wpdb->get_results("SELECT id, name, guardian FROM school_students");
    $id_student = $_POST["id_student"];
    $id_lesson = $_POST['id_lesson'];
    $attend = $_POST['attend'];
    //insert
    if (isset($_POST['insert'])) {
        $date = date("Y-m-d");
        $rowsLesson = $wpdb->get_results("SELECT subject, lesson, sub.name\n                                            FROM school_scheduler as sch\n                                            LEFT JOIN school_subjects as sub\n                                            ON sch.subject = sub.id\n                                            WHERE subject_date = '{$date}'");
        $lesson = $rowsLesson[0]->lesson;
        $lessonName = $rowsLesson[0]->name;
        $rowStudent = $wpdb->get_results("SELECT id, name, guardian FROM school_students WHERE id = {$id_student}");
        $wpdb->insert('school_attendance', array('student_id' => $id_student, 'lesson_id' => $id_lesson, 'date' => $date, 'attend' => $attend), array('%s', '%s', '%s', '%s'));
        if ($attend === '0') {
            $guardian = $rowStudent[0]->guardian;
            $rowUsers = $wpdb->get_results("SELECT *\n                                      FROM `wp_users` as u\n                                      LEFT JOIN `wp_usermeta` as m \n                                      ON u.ID = m.user_id\n                                      WHERE m.meta_key LIKE 'phone_number' AND user_id = {$guardian}");
            $to = $rowUsers[0]->user_email;
            $name = $rowUsers[0]->user_login;
            $studentName = $rowStudent[0]->name;
            $text = "{$name} Twoje dziecko {$studentName}  jest nieobecne w szkole na lekcji {$lesson}. {$lessonName}";
            $mailMessage = wp_mail($to, 'Nieobecność', $text);
            $contactNumber = $rowUsers[0]->meta_value;
            $smsMessage = sendSms($contactNumber, $text);
        }
        $message .= "Obecność dodana !";
    }
    ?>
    <div class="container">
        <h2>Dodaj obecność</h2>
        <?php 
    if (isset($message)) {
        ?>
<div class="updated"><p><?php 
        echo $message;
        ?>
</p></div><?php 
    }
    ?>
        
        <form method="post" action="<?php 
    echo $_SERVER['REQUEST_URI'];
    ?>
">   
        
        <div class="form-group">
          <label for="">Uczeń</label>
          <select name="id_student" class="form-control">
          <?php 
    foreach ($rowsStudent as $row) {
        echo '<option value="' . $row->id . '">' . $row->name . '</option>';
    }
    ?>
          </select>
        </div>    
            
        <div class="form-group">
            <label for="">Lekcja</label>
            <select name="id_lesson" class="form-control">
            <?php 
    foreach ($rowsLesson as $row) {
        echo '<option value="' . $row->lesson . '">Lekcja:' . $row->lesson . ' = ' . $row->name . '</option>';
    }
    ?>
            </select>
        </div>
            
        <div class="form-group">
          <label for="">Obecność</label>
          <select name="attend" class="form-control">
            <option value="1">Obecny</option>';
            <option value="0">Nieobecny</option>';
          </select>
        </div>
        <button type="submit" name="insert" class="btn btn-default">Zapisz</button>
        <a href="<?php 
    echo admin_url('admin.php?page=NK_attendance_list');
    ?>
">&laquo; Powróć do listy</a>
        </form>
    </div>
<?php 
}
<?php

include './include/DbHandler.php';
$db = new DbHandler();
header('Content-Type: application/json');
$response = array();
if (isset($_POST['mobile']) && $_POST['mobile'] != '') {
    $name = $_POST['name'];
    $vehicle_reg_no = $_POST['vehicle_reg_no'];
    $mobile = $_POST['mobile'];
    $otp = rand(100000, 999999);
    $res = $db->createUser($name, $vehicle_reg_no, $mobile, $otp);
    if ($res == USER_CREATED_SUCCESSFULLY) {
        // send sms
        sendSms($mobile, $otp);
        $response["error"] = false;
        $response["message"] = "SMS request is initiated! You will be receiving it shortly.";
    } else {
        if ($res == USER_CREATE_FAILED) {
            $response["error"] = true;
            $response["message"] = "Sorry! Error occurred in registration.";
        } else {
            if ($res == USER_ALREADY_EXISTED) {
                $response["error"] = true;
                $response["message"] = "Mobile number already existed!";
            }
        }
    }
} else {
    $response["error"] = true;
    $response["message"] = "Sorry! mobile number is not valid or missing.";
示例#16
0
 public function postSendVerify($type = null, RateLimiter $rateLimiter)
 {
     $user = auth()->user();
     $request = request();
     $response = response();
     if (!$type) {
         $type = $request->input('type');
     }
     if ($type != 'phone' && $type != 'email') {
         $response->json(['status' => false, 'message' => '发送失败,Type参数错误!']);
     }
     $typeValue = $request->input('input_value');
     if ($type == 'email') {
         if ($typeValue == $user->email || !is_email($typeValue) || strlen($typeValue) > 64) {
             return $response->json(['status' => false, 'message' => '请输入正确的新邮箱']);
         }
     } elseif ($type == 'phone') {
         if ($typeValue == $user->phone || !is_phone($typeValue)) {
             return $response->json(['status' => false, 'message' => '请输入正确的新手机号']);
         }
     }
     // 60秒发送一次
     $sessionKey = 'send_verify_last_time';
     $sessionKey .= ".change.{$type}";
     $sessionValue = session($sessionKey);
     $currentTime = time();
     if ($sessionValue && $sessionValue + 60 > $currentTime) {
         return $response->json(['status' => false, 'message' => '发送失败,请不要频繁获取验证码']);
     }
     // 一个IP一个小时可以发送10次
     $rateLimiterKey = 'send_verify_rate_limiter';
     $rateLimiterKey .= ":change:{$type}_" . $user->id;
     if ($rateLimiter->tooManyAttempts($rateLimiterKey, 60, 10)) {
         return $response->json(['status' => false, 'message' => '当前网络环境获取已达上限,请一小时后再试']);
     }
     if (User::hasBeenUsed($type, $typeValue, true)->exists()) {
         $typeName = $type == 'phone' ? '手机号' : '邮箱';
         return $response->json(['status' => false, 'message' => '此' . $typeName . '已被其他用户使用']);
     }
     $code = rand(100000, 999999);
     $value = ['type' => $type, 'code' => $code, 'value' => $typeValue, 'attempt' => 0, 'user_id' => $user->id];
     $cacheKey = md5("send_verify_detail.change.{$typeValue}" . config('key'));
     if ($type == 'phone') {
         require app_path('Services/Taobao/TopSdk.php');
         $status = sendSms('phone_change', $typeValue, ['code' => $code, 'product' => '积木']);
     } elseif ($type == 'email') {
         $vars = ['email' => $typeValue, 'code' => $code, 'link' => url('account/set/change-confirm') . '?key=' . urlencode($cacheKey)];
         $view = 'user.set.change_verify_mail';
         $status = \Mail::send($view, $vars, function ($message) use($typeValue) {
             $message->to($typeValue);
             $message->subject('[积木] 邮箱绑定验证码');
         });
     }
     if (empty($status)) {
         $status = false;
     } else {
         Cache::put($cacheKey, $value, 60);
         session([$sessionKey => $currentTime]);
         $rateLimiter->hit($rateLimiterKey);
     }
     $typeName = $type == 'phone' ? '短信' : '邮件';
     return $response->json(['status' => (bool) $status, 'message' => $status ? '' : 'Oh. 验证' . $typeName . '发送失败,请稍后重试']);
 }
示例#17
0
<?php

error_reporting(E_ALL ^ E_WARNING ^ E_DEPRECATED);
define("RelativePath", "../..");
define("PathToCurrentPage", "/include/excel/");
define("FileName", "curl_tes_2.php");
include_once RelativePath . "/Common.php";
function sendSms()
{
    include 'save_excel_2.php';
    include '../../gammu/send_sms.php';
    $SendSms = new SendSms();
    $dbConn = new clsDBConnSIKP();
    $query = "SELECT * FROM t_sms_outbox where is_sent = 'N'";
    $dbConn->query($query);
    $data = array();
    while ($dbConn->next_record()) {
        $data[] = $item = array('t_sms_outbox_id' => $dbConn->f("t_sms_outbox_id"), 'npwpd' => $dbConn->f("npwpd"), 'mobile_no' => $dbConn->f("mobile_no"), 'message' => $dbConn->f("message"), 'is_sent' => $dbConn->f("is_sent"), 'date_sent' => $dbConn->f("date_sent"), 'date_addded' => $dbConn->f("date_addded"));
        $SendSms->send($item["mobile_no"], $item["message"]);
    }
    for ($counter = 0; $counter < sizeof($data); $counter++) {
        $query = " UPDATE t_sms_outbox\r\n\t   \t\tSET is_sent='Y',date_sent=sysdate\r\n\t \t\tWHERE t_sms_outbox_id=" . $data[$counter]['t_sms_outbox_id'];
        $dbConn->query($query);
    }
}
sendSms();
示例#18
0
</head>

<body>
<?php 
echo date("Y-m-d H:i:s");
?>
<br />
<hr />
<form action="" method="post">
	<label for="sender">Number</label><input type="text" max="13" name="sender" /><br />
    <label for="text">Text</label><input type="text" max="160" name="text" /><br />
    <input type="submit" name="submit" />

</form>


<br />
<br />

<?php 
if (isset($_POST['sender'])) {
    require "system/library/functions.php";
    if (sendSms($_POST['sender'], $_POST['text'])) {
        echo "sent";
    } else {
        echo "not sent";
    }
}
?>
</body>
</html>
示例#19
0
 public function sendDeclaration()
 {
     $data = array('sender' => $this->input->post('sender'), 'recipient' => $this->input->post('recipient'), 'message' => $this->input->post('message'));
     $validateNumber = phoneNumberValidation($data['recipient']);
     if (!is_null($validateNumber)) {
         $data['recipient'] = $validateNumber;
         $totalRecipient = count($validateNumber) ? count($validateNumber) : 0;
         $result = sendSms($data);
         $curDate = getCurDateStamp();
         $logData = array('details' => 'Daily declaration', 'msg_code' => $this->input->post('code_text_value'), 'sent_by' => 'Oluwafemi', 'created_at' => $curDate, 'total_recipients' => (int) $totalRecipient);
         $this->smsusagelog_model->insert_log($logData);
         $response['declareSuccessfull'] = 'SMS Sent Successfully.';
     } else {
         $response['declareError'] = "Invalid Phone Number format detected";
     }
     $this->load->view('controlcentre/declarations/view', $response);
 }
示例#20
0
function api_sendSms()
{
    checkAuth(AUTH_EMP);
    $phone = mparam("phone");
    $content = mparam("content");
    $channel = param("channel", 0);
    sendSms($phone, $content, $channel, true);
}