//php页面
//手机号 public function shou(){ $tel=Request::instance()->param('tel'); $this->tel($tel); } //手机验证码 public function tel($tel){ $statusStr = array( "0" => "短信发送成功", "-1" => "参数不全", "-2" => "服务器空间不支持,请确认支持curl或者fsocket,联系您的空间商解决或者更换空间!", "30" => "密码错误", "40" => "账号不存在", "41" => "余额不足", "42" => "帐户已过期", "43" => "IP地址限制", "50" => "内容含有敏感词" ); $smsapi = "http://api.smsbao.com/"; $user = "zhangjinchai"; //短信平台帐号 $pass = md5("19971212zjc"); //短信平台密码 $content="【上海宏烨集团】您本次皇室验证码是:".$this->suiji();//要发送的短信内容 $phone = $tel;//要发送短信的手机号码 $sendurl = $smsapi."sms?u=".$user."&p=".$pass."&m=".$phone."&c=".urlencode($content); $result =file_get_contents($sendurl); if($result){ return true; }else{ return false; } } //生成4位随机的数 public function suiji(){ $a=rand(1000,9999); Session::set('phone_code',$a); return $a;
} //传输手机号
( js) $(".tel").click(function () { var tel=$("#tel").val(); $.post( "{:url('index/shou')}", { tel:tel }, function (data) { } ) }) //进行账号密码验证 $(".but").click(function () { var u_name=$("#u_name").val(); var u_pwd=$("#u_pass").val(); var yzm=$("#yzm").val(); $.post( "{:url('index/login_do')}", { u_name:u_name, u_pwd:u_pwd, yzm:yzm }, function (data) { if(data==1){ alert("注册成功"); location.href="{:url('index/index')}"; }else{ alert("注册失败"); } } ) })
( js) $(".tel").click(function () { var tel=$("#tel").val(); $.post( "{:url('index/shou')}", { tel:tel }, function (data) { } ) }) //进行账号密码验证 $(".but").click(function () { var u_name=$("#u_name").val(); var u_pwd=$("#u_pass").val(); var yzm=$("#yzm").val(); $.post( "{:url('index/login_do')}", {
u_name:u_name, u_pwd:u_pwd, yzm:yzm }, function (data) { if(data==1){ alert("注册成功"); location.href="{:url('index/index')}"; }else{ alert("注册失败"); } }) })