以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]传递一下参数,让客户端接收 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=159906) |
-- 作者:fczhaobo -- 发布时间:2021/1/13 10:54:00 -- [求助]传递一下参数,让客户端接收 Dim e As RequestEventArgs = args(0) Dim wb As New weui Dim sjh As String = e.postvalues("sjh") Dim yzm As String = Rand.Next(2001,9999) \'生成200到300之间的随机整数 Dim product As String = "Dysmsapi" \'无需更改,官方名称 Dim domain As String = "dysmsapi.aliyuncs.com" \'无需更改,官方名称 Dim accessId As String = "*************" \'更换为您的AccessKey Dim accessSecret As String = "************" \'更换为您的AccessSecret Dim regionIdForPop As String = "cn-hangzhou" \'无需更改,官方名称 Dim profile As Aliyun.Acs.Core.Profile.IClientProfile = Aliyun.Acs.Core.Profile.DefaultProfile.GetProfile(regionIdForPop, accessId, accessSecret) Aliyun.Acs.Core.Profile.DefaultProfile.AddEndpoint(regionIdForPop, regionIdForPop, product, domain) Dim acsClient As Aliyun.Acs.Core.IAcsClient = New Aliyun.Acs.Core.DefaultAcsClient (profile) Dim request As Aliyun.Acs.Dysmsapi.Model.V20170525.SendSmsRequest = New Aliyun.Acs.Dysmsapi.Model.V20170525.SendSmsRequest() Dim response As Aliyun.Acs.Dysmsapi.Model.V20170525.SendSmsResponse = Nothing Try request.PhoneNumbers = sjh request.SignName = "逸飞书画学校" \'更换为您备案的短信签名 request.TemplateCode = "******" \'更换您备案的短信模板 request.TemplateParam = "{""code"":""" & yzm & """}" \' \'如果您有可 替换的标签,可以设置设置json,也可以注释掉 response = acsClient.GetAcsResponse(request) e.WriteString(yzm) \'传递验证码参数? Catch ex As Exception e.WriteString("短信代码有问题,请联系技术员") End Try 目的,就是把生成的验证码让客户端手机接收,以cookice方式存储。
|
-- 作者:fczhaobo -- 发布时间:2021/1/13 10:56:00 -- wb.AddTopTips("","toptip1","") \'用于显示动态错误提示 wb.AddForm("","form1","wxyz.htm").Attribute="" With wb.AddInputGroup("form1","ipg1","请输入学员报名时登记的联系电话") With .AddInputCell("ic1") \'通过InputCell增加输入框(1表示突出显示,2表示红色警示图标) .AddLabel("ljh","手机",0) \'增加标签(0显示在左边) .AddInput("sjh","text",1).PlaceHolder= "请输入手机号" \'增加输入框(0靠左显示,1居中显示,2靠右显示) .AddVcodeButton("vyz","获取验证码",2).Attribute="" \'sjh(是个input输入值)和yzm(是个变量)都用需要进行替换 End With With .AddInputCell("ic2") .AddLabel("lyz","验证",0) .AddInput("iyz","text",1).PlaceHolder= "请输入验证码" End With End With With wb.AddButtonGroup("form1","btg1",True) .Add("btn1", "确定", "submit") End With \'wb.AppendHTML("<div id=\'p1\' style=\'margin:0.5em\'></div>") \'插入一个div,用于显示服务器返回的数据 wb.AppendHTML("<script src=\'./lib/ajaxform.js\'></script>") \'引入脚本文件 e.WriteString(wb.Build)
|
-- 作者:fczhaobo -- 发布时间:2021/1/13 10:57:00 -- \'lib/ajaxform.js function getUser(){ var result= submitAjaxFileds(\'faduanxin.htm\',\'\',\'sjh\',false); document.getElementById("p1").innerHTML=result; document.getElementById("vyz").disabled=false; alert(result); } |
-- 作者:有点蓝 -- 发布时间:2021/1/13 11:03:00 -- 短信验证码是要使用手机短信接收的吧,没有必要发回客户端网页。 |
-- 作者:有点蓝 -- 发布时间:2021/1/13 11:05:00 -- 个人建议是在数据库建一个表,存储手机号、验证码,超时时间,然后然后通过查表判断用户填入的额验证码是否正确 |
-- 作者:fczhaobo -- 发布时间:2021/1/13 11:20:00 -- 建数据表,我嫌麻烦,接着验判了才好呢? |
-- 作者:有点蓝 -- 发布时间:2021/1/13 11:25:00 -- 把验证码发回前端不安全,有没有手机都能看到这个验证码了 |
-- 作者:fczhaobo -- 发布时间:2021/1/13 11:29:00 -- OK,采纳建议,谢谢 |