reg_send.asp
上传用户:stone001
上传日期:2016-10-28
资源大小:685k
文件大小:4k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

ASP/ASPX

  1. <!--插入html头部分以及数据库接口-->
  2. <!--#include file="in_conn.asp"-->
  3. <!--#include file="inc/md5.asp"-->
  4. <!--#include file="UpLoadClass.asp"-->
  5. <%
  6. Server.ScriptTimeOut=5000
  7. dim request2 
  8. '建立上传对象
  9. set request2=New UpLoadClass
  10. '使用手动方式保存
  11. request2.AutoSave=2
  12. request2.SavePath="face/upface/"
  13. '打开对象
  14. request2.open()
  15. '判断用户名格式的函数
  16. FUNCTION userstr(stru)
  17. dim i,aa
  18. dim istr
  19.   For i=1 To Len(stru)
  20. istr=mid(stru,i,1)
  21. aa=ASC(istr)
  22. If aa>31 AND aa<48 Then
  23. userstr=False
  24. Exit For
  25. Elseif aa>57 AND aa<65 Then
  26. userstr=False
  27. Exit For
  28. Elseif aa>90 AND aa<95 Then
  29. userstr=False
  30. Exit For
  31. Elseif aa>95 AND aa<97 Then
  32. userstr=False
  33. Exit For
  34. Else
  35. userstr=True
  36. End if
  37.   Next
  38. END FUNCTION
  39. '判断邮件格式是否正确
  40. Function isEmail(strng)
  41.      Dim regEx,regVal
  42.      Set regEx=New RegExp
  43.      regEx.Pattern="^w+((-w+)|(.w+))*@[A-Za-z0-9]+((.|-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$"
  44.      regEx.IgnoreCase=True
  45.      isEmail=regEx.Test(strng)
  46. End Function
  47. dim vname,vpwd,vrepwd,vemail,vhome,vnowdo,vcontact,vface,vsign
  48. dim vsex,vqq,vhometel,vmob,vy,vm,vd,vfacew,vfaceh
  49. dim vbirth,vdate
  50. '获得表单传值
  51. vname=trim(Request2.Form("txtname"))
  52. vpwd=trim(Request2.Form("txtpwd"))
  53. vrepwd=trim(Request2.Form("txtrepwd"))
  54. vemail=trim(Request2.Form("txtemail"))
  55. vhome=trim(Request2.Form("txthome"))
  56. vnowdo=trim(Request2.Form("txtdo"))
  57. vcontact=trim(Request2.Form("txtcontact"))
  58. vsign=trim(Request2.Form("txtsign"))
  59. if Request2.Form("radsex")="gg" then
  60. vsex=1
  61. else
  62. vsex=0
  63. end if
  64. vqq=trim(Request2.Form("txtqq"))
  65. vhometel=trim(Request2.Form("txthometel"))
  66. vmob=trim(Request2.Form("txtmobile"))
  67. vy=Request2.Form("syear")
  68. vm=Request2.Form("smonth")
  69. vd=Request2.Form("sday")
  70. vdate=now()
  71. '检查正确性
  72. If userstr(vname)=False or vname="" Then
  73. Response.Redirect "resp.asp?cmd=uname_err"
  74. ElseIf isEmail(vemail)=False or vemail="" Then
  75. Response.Redirect "resp.asp?cmd=uemail_err"
  76. ElseIf Len(vpwd)<6 OR Len(vpwd)>14 Then
  77. Response.Redirect "resp.asp?cmd=upwd_len"
  78. ElseIf vpwd<>vrepwd Then
  79. Response.Redirect "resp.asp?cmd=urepwd_err"
  80. ElseIf vcontact<>"" And Len(vcontact)>150 Then
  81. Response.Redirect "resp.asp?cmd=ucontact_len"
  82. ElseIf vsign<>"" And Len(vsign)>255 Then
  83. Response.Redirect "resp.asp?cmd=usign_len"
  84. ElseIf vqq<>"" And isnumeric(vqq)=False Then
  85. Response.Redirect "resp.asp?cmd=uqq_num"
  86. End If
  87. '检查是否重复注册
  88. sqlstr="SELECT ID FROM tblmates WHERE name='"&vname&"'"
  89. rs.open sqlstr,conn,1,1
  90. if NOT(rs.eof AND rs.bof) then
  91. Response.Redirect "resp.asp?cmd=ureg_2"
  92. end if
  93. rs.close
  94. IF Request2.Form("radface")="up" THEN
  95. Request2.MaxSize=102400
  96. if Request2.Save("strFace",0) then
  97. '如果上传成功
  98. vface=Request2.SavePath&Request2.Form("strFace")
  99. vfacew=Request2.Form("strFace_Width")
  100. vfaceh=Request2.Form("strFace_Height")
  101. if isNumeric(vfacew) then
  102. If vfacew>150 or vfaceh>150 Then
  103. '如果图片宽高不符界限,则
  104. if vfacew>vfaceh then
  105. vfaceh=Cint(150 / vfacew * vfaceh)
  106. vfacew=150
  107. else
  108. vfacew=Cint(150 / vfaceh * vfacew)
  109. vfaceh=150
  110. end if
  111. End If
  112. else
  113. vfacew=150
  114. vfaceh=150
  115. end if
  116. else
  117. '如果上传失败
  118. Response.Redirect "resp.asp?cmd=uface_up"
  119. end if
  120. Else
  121. vface="face/"&Request2.Form("sface")&".gif"
  122. vfacew=42
  123. vfaceh=85
  124. END IF
  125. vy=Request2.Form("syear")
  126. vm=Request2.Form("smonth")
  127. vd=Request2.Form("sday")
  128. if isDate(vy&"-"&vm&"-"&vd) then
  129. vbirth=CDate(vy&"-"&vm&"-"&vd)
  130. else
  131. Response.Redirect "resp.asp?cmd=ubirth_day"
  132. end if
  133. set request2=Nothing
  134. 'MD5加密
  135. vpwd=md5(vpwd,32)
  136. '开始插入数据
  137. sqlstr="INSERT INTO tblmates(name,pwd,sex,email,qq,home,hometel,mobile,nowdo,contact,birthday,birthm,regdate,lastlog,power,faceurl,facew,faceh,cnt_water,cnt_on,signline,myfj) VALUES('"&stryin(vname)&"','"&stryin(vpwd)&"',"&vsex&",'"&stryin(vemail)&"','"&stryin(vqq)&"','"&stryin(vhome)&"','"&stryin(vhometel)&"','"&stryin(vmob)&"','"&stryin(vnowdo)&"','"&stryin(vcontact)&"',#"&vbirth&"#,"&vm&",#"&vdate&"#,#"&vdate&"#,0,'"&stryin(vface)&"',"&vfacew&","&vfaceh&",0,1,'"&stryin(vsign)&"',0)"
  138. conn.Execute sqlstr
  139. Session("sname")=vname
  140. Response.Redirect "rego.asp?cmd=reg_ok"
  141. %>
  142. <body>
  143. <!--插入网站置底-->
  144. <!--#include file="in_bottom.asp"-->
  145. </body>
  146. </html>