<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostFunction.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
If session("username")="" And session("SMSAUusername")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
ElseIf not IsNumeric(Request("SendNum"))  Then
	ef=True
	ec="手机号应该是数字！"
end if

If not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
 Set dsreg = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_USER where username='"&session("username")&"'"
If session("username")="" Then 	Sql="Select * from FreeHost.FreeHost_USER where username='"&session("SMSAUusername")&"'"
		dsreg.Open Sql,conn,1,3
if dsreg.Eof then
	ef=True
	ec="不存在的用户！"
end if
end If

if Application("mobimustone")=true And not ef Then
Set dsregSMS = Server.CreateObject("ADODB.Recordset")	
	Sql="Select * from FreeHost.FreeHost_USER where username<>'"&dsreg("username")&"' and mobi='"&Request.Form ("SendNum")&"'"
		if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
		dsregSMS.Open Sql,conn,1,3
If not dsregSMS.Eof Then
		ef=True
		ec="这个手机号码已被别人使用了，一个手机号码只能用来验证一个用户名！"
end if
end If


if not ef then
if DateDiff("s",session("lastusetime"),NOW )>3600 then
dsreg("checkmobisend")=0
session("lastusetime")=now
end if
end If

if not ef then
if dsreg("checkmobisend")>2 then
	ef=True
	ec="一小时内不能重复发送超过3条验证短信。"
end if
end if

if not ef Then

dsreg("checkmobisend")=dsreg("checkmobisend")+1
dsreg("mobi")=Request("SendNum")
dsreg.update
Sql="UPDATE [FreeHost].[FreeHost_AGENT] set mobi='"&session ("SendNum")&"' where username='"&session ("username")&"'"
    conn.Execute Sql

SERVER_NAME=Request.ServerVariables("SERVER_NAME")
'smskey=Left(md5(now),8)

Randomize
smskey=int(9000*rnd())+1000

session("smskey")=smskey
If Request.ServerVariables("HTTP_FreeHostAPISITE")<>"" Then SERVER_NAME=Request.ServerVariables("HTTP_FreeHostAPISITE")
ret=SendSms(Request("SendNum"),"发自:"&SERVER_NAME&",发送时间:"&Now&",您的手机验证码是:"&smskey&"【感谢支持】",0,Now,"")
%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html2")%>
验证手机号码
<%=htmlwrite("html3")%>
<br>
<br>
<br>
<table width="100%"  border="0" cellspacing="0" cellpadding="0" id="table1">
    <tr>
      <td width="10" height="23" background="img/contopa.gif">&nbsp;</td>
      <td height="23" align="left" valign="top" background="img/contopb.gif"><table width="100%"  border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="8" colspan="3"></td>
          </tr>
          <tr>
            <td width="25">&nbsp;</td>
            <td align="left" valign="top"><font color="#FFFFFF"><strong>请您输入验证码:</strong></font></td>
            <td width="10">&nbsp;</td>
          </tr>
      </table></td>
      <td width="10" height="23" background="img/contopc.gif">&nbsp;</td>
    </tr>
    <tr>
      <td background="img/conmid1.gif">&nbsp;</td>
      <td><br>

	  <form name="form1" method="post" action="checkmobi3.asp">
          <table width="100%"  border="0" cellspacing="1" bgcolor="#CCCCCC">
            <tr bgcolor="#EEEEEE">
              <td height="60" align="center" bgcolor="#EEEEEE">第二步，请输入您手机收到的验证码。</td>
            </tr>

            <tr bgcolor="#FFFFFF">
              <td height="9" align="center" bgcolor="#FFFFFF">
                请输入您手机收到的<font color="#FF0000">验证码</font>：
                    <input name="smskey" type="text" id="smskey">
                <input type="submit" name="Submit" value="马上验证">
               
                
              </td>
            </tr>
            <tr bgcolor="#FFFFFF">
              <td height="40" align="center" bgcolor="#FFFFFF"><SPAN id=boxs>此次验证全程免费，不会向您收取任何费用　　<%if Application("smsau")=false then%><a href="logininfo.asp">关闭提示</a>　　<a href="checkmobiclose.asp">以后不再提示</a></SPAN><%End if%></td>
            </tr>

          </table></form>
      </td>
      <td width="10" background="img/conmid2.gif">&nbsp;</td>
    </tr>
    <tr>
      <td width="10" height="10"><img src="img/conend1.gif" width="10" height="10"></td>
      <td height="10" background="img/conend2.gif"></td>
      <td width="10" height="10"><img src="img/conend3.gif" width="10" height="10"></td>
    </tr>
</table>
  <br>  
  <%=htmlwrite("html4")%>
<%
conn.Close
set conn=nothing
end if

if ef then
Response.Redirect "e.asp?e="&ec
end if%>
