checkcode.asp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <%
  2. Option Explicit
  3. Const listcode = "0123456789abcdefghijklmnopqrstuvwxyz"
  4. Response.buffer = True
  5. Response.Expires = -1
  6. Response.AddHeader "Pragma", "no-cache"
  7. Response.AddHeader "cache-ctrol", "no-cache"
  8. Dim zNum, rNum, i, j, listnum
  9. Dim Ados, Ados1
  10. Dim zimg(6), NStr
  11. Randomize Timer
  12. For i = 0 To 5
  13. rNum = Fix(35 * Rnd)
  14. zimg(i) = rNum
  15. listnum = listnum & Mid(listcode, rNum + 1, 1)
  16. Next
  17. Session("CheckCode") = listnum
  18. Dim Pos
  19. Set Ados = Server.CreateObject("Adodb.Stream")
  20. Ados.Mode = 3
  21. Ados.Type = 1
  22. Ados.Open
  23. Set Ados1 = Server.CreateObject("Adodb.Stream")
  24. Ados1.Mode = 3
  25. Ados1.Type = 1
  26. Ados1.Open
  27. Ados.LoadFromFile Server.mappath("body.Fix")
  28. Ados1.write Ados.Read(2880)
  29. For i = 0 To 5
  30. Ados.Position = (35 - zimg(i)) * 480
  31. Ados1.Position = i * 480
  32. Ados1.write Ados.Read(480)
  33. Next
  34. Ados.LoadFromFile Server.mappath("head.fix")
  35. Pos = LenB(Ados.Read())
  36. Ados.Position = Pos
  37. On Error Resume Next
  38. For i = 0 To 15
  39. For j = 0 To 5
  40. Ados1.Position = i * 32 + j * 480
  41. Ados.Position = Pos + 30 * j + i * 270
  42. Ados.write Ados1.Read(30)
  43. Next
  44. Next
  45. Ados.Position = 0
  46. Response.ContentType = "inc/BMP"
  47. Response.BinaryWrite Ados.Read()
  48. Ados.Close
  49. Set Ados = Nothing
  50. Ados1.Close
  51. Set Ados1 = Nothing
  52. %>