Example #1
0
<?php

require_once "../includes/config.inc.php";
$mobile = $_POST['mobile'];
$send_code = $_POST['send_code'];
$mobile_code = code_random(4, 1);
if (empty($mobile)) {
    exit('手机号码不能为空');
}
//防用户恶意请求
if (empty($_SESSION['send_code']) or $send_code != $_SESSION['send_code']) {
    exit('请求超时,请刷新页面后重试');
}
$post_data = "您的验证码是:" . $mobile_code . "。请不要把验证码泄露给其他人。如非本人操作,可不用理会!";
$gets = xml_to_array(send_phone_msg($mobile, $post_data));
//file_put_contents('../data/sms.txt',$post_data);$gets['SubmitResult']['code']=2;
/* if($gets['SubmitResult']['code']==2){
	$_SESSION['mobile'] = $mobile;
	$_SESSION['mobile_code'] = $mobile_code;//手机验证码
	echo 'suc';
}else{
	echo 'err';
} */
$_SESSION['mobile'] = $mobile;
$_SESSION['mobile_code'] = $mobile_code;
//手机验证码
echo 'suc';
die;
Example #2
0
<?php

include_once "../../includes/config.inc.php";
$model = new Model_Subtable('sub_sign');
$userModel = new Model_Subtable('sub_user');
if ($_REQUEST['a'] == 'send') {
    $name = $_GET['name'];
    $phone = $_GET['phone'];
    $tid = $_GET['tid'];
    //职位信息
    $taskModel = D('sub_task');
    $taskRow = $taskModel->find($tid);
    $post_data = "你好" . $name . "(手机尾号为" . substr($phone, -4) . "),你已成功报名" . $taskRow['title'] . ",请于" . $taskRow['jihe_time'] . "到" . $taskRow['jihe_address'] . "集合!";
    send_phone_msg($phone, $post_data);
    die;
}
$listArr = $model->where("tid='{$_GET['tid']}' and is_valid=1")->dataArr();
foreach ($listArr as $key => $value) {
    $uRow = $userModel->field('id,username,nickname')->where("id='{$value['uid']}'")->dataRow();
    $listArr[$key] = $uRow;
    $listArr[$key]['xuhao'] = $key + 1;
}
$smarty->assign('list', $listArr);
$smarty->assign('tid', $_GET['tid']);
$smarty->setTpl('task/templates/send_phone_msg.html')->display();