PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/Wap/User/CheckUserlogin.asp

https://github.com/joechen2010/health
ASP | 103 lines | 94 code | 6 blank | 3 comment | 0 complexity | be4a8fd8d1adc2d831d5386c0c9b2454 MD5 | raw file
  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
  2. <%
  3. Option Explicit
  4. Response.ContentType="text/vnd.wap.wml"
  5. Response.Charset="utf-8"
  6. Response.Write "<?xml version=""1.0"" encoding=""utf-8""?>" &vbcrlf
  7. Response.Write "<!DOCTYPE wml PUBLIC ""-//WAPFORUM//DTD WML 1.1//EN"" ""http://www.wapforum.org/DTD/wml_1.1.xml"">" &vbcrlf
  8. %>
  9. <!--#include file="../Conn.asp"-->
  10. <!--#include file="../KS_Cls/Kesion.CommonCls.asp"-->
  11. <!--#include file="../KS_Cls/Kesion.Label.CommonCls.asp"-->
  12. <!--#include file="../KS_Cls/Md5.asp"-->
  13. <%
  14. Dim KSCls
  15. Set KSCls = New UserLogin
  16. KSCls.Kesion()
  17. Set KSCls = Nothing
  18. Class UserLogin
  19. Private KS
  20. Private UserName,PassWord,Verifycode,ExpiresDate,RndPassword
  21. Private LoginVerificCodeTF
  22. Private Sub Class_Initialize()
  23. Set KS=New PublicCls
  24. End Sub
  25. Private Sub Class_Terminate()
  26. Call CloseConn()
  27. Set KS=Nothing
  28. End Sub
  29. Public Sub Kesion()
  30. UserName=KS.R(KS.S("UserName"))
  31. PassWord=KS.R(KS.S("PassWord"))
  32. ExpiresDate=KS.R(KS.S("ExpiresDate"))
  33. Verifycode=KS.R(KS.S("Verifycode"))
  34. LoginVerificCodeTF=KS.Setting(34)
  35. RndPassword=KS.R(KS.MakeRandomChar(20))
  36. IF UserName="" Then
  37. Call KS.ShowError("错误提示","用户名不能为空,请输入!")
  38. End IF
  39. IF PassWord="" Then
  40. Call KS.ShowError("错误提示","登录密码不能为空,请输入!")
  41. End IF
  42. IF Trim(Verifycode)<>Trim(Session("Verifycode")) And LoginVerificCodeTF=1 Then
  43. Call KS.ShowError("错误提示","验证码有误,请重新输入!")
  44. End IF
  45. PassWord=MD5(PassWord,16)
  46. Dim UserRS:Set UserRS=Server.CreateObject("Adodb.RecordSet")
  47. UserRS.Open "Select UserID,UserName,PassWord,Locked,GroupID,Score,LastLoginIP,LastLoginTime,LoginTimes,RndPassword,IsOnline,GradeTitle,wap From KS_User Where UserName='" &UserName & "' And PassWord='" & PassWord & "'",Conn,1,3
  48. If UserRS.Eof And UserRS.BOf Then
  49. UserRS.Close:Set UserRS=Nothing
  50. Call KS.ShowError("错误提示","你输入的用户名或密码有误,请重新输入!")
  51. ElseIf UserRS("Locked")=1 Then
  52. UserRS.Close:Set UserRS=Nothing
  53. Call KS.ShowError("错误提示","您的账号已被管理员锁定,请与管理员联系!")
  54. ElseIF UserRS("Locked")=3 Then
  55. UserRS.Close:Set UserRS=Nothing
  56. Call KS.ShowError("错误提示","您的账号还没有激活,请注意查收您的邮箱并进行激活!")
  57. ElseIF UserRS("Locked")=2 Then
  58. UserRS.Close:Set UserRS=Nothing
  59. Call KS.ShowError("错误提示","您的账号还没有通过认证!")
  60. Else
  61. '登录成功,更新用户相应的数据
  62. If datediff("n",UserRS("LastLoginTime"),now)>=KS.ChkClng(KS.Setting(36)) Then '判断时间
  63. UserRS("Score")=UserRS("Score")+KS.ChkClng(KS.Setting(37))
  64. End If
  65. UserRS("LastLoginIP") = KS.GetIP
  66. UserRS("LastLoginTime") = Now()
  67. UserRS("LoginTimes") = UserRS("LoginTimes") + 1
  68. UserRS("RndPassword")= RndPassword
  69. UserRS("IsOnline")=1
  70. If KS.IsNul(UserRS("wap")) or KS.strLength(UserRS("wap")) < 32 Then UserRS("wap")= MD5(KS.MakeRandomChar(20),32)
  71. UserRS.Update
  72. '***************************************
  73. on error resume next
  74. UserRS("GradeTitle")=Conn.Execute("select top 1 usertitle from KS_AskGrade where score<=" & UserRS("Score") & " order by score desc")(0)
  75. UserRS.Update
  76. Dim ToUrl
  77. ToUrl = KS.S("ToUrl")
  78. ToUrl = Replace(Replace(ToUrl,"&amp;","&"),"&","&amp;")
  79. If ToUrl = "" Then ToUrl = "Index.asp"
  80. ToUrl = KS.JoinChar(ToUrl)
  81. ToUrl = ToUrl & KS.WSetting(2) & "=" & UserRS("wap") & ""
  82. '***************************************
  83. Response.Write "<wml>" &vbcrlf
  84. Response.Write "<head>" &vbcrlf
  85. Response.Write "<meta http-equiv=""Cache-Control"" content=""no-Cache""/>" &vbcrlf
  86. Response.Write "<meta http-equiv=""Cache-Control"" content=""max-age=0""/>" &vbcrlf
  87. Response.Write "</head>" &vbcrlf
  88. Response.Write "<card title=""正在进入.."" newcontext=""true"" ontimer=""" & ToUrl & """><timer value=""3""/>" &vbcrlf
  89. Response.Write "<p align=""left"">" &vbcrlf
  90. Response.Write "登陆成功...<a href="""&ToUrl&""">马上进入</a>"
  91. Response.Write "</p>" &vbcrlf
  92. Response.Write "</card>" &vbcrlf
  93. Response.Write "</wml>"
  94. End If
  95. End Sub
  96. End Class
  97. %>