Clone of Akilla's acserver @ https://github.com/deregtd/ACServer

LoginClientForm.frm 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. VERSION 5.00
  2. Object = "{248DD890-BB45-11CF-9ABC-0080C7E7B78D}#1.0#0"; "MSWINSCK.OCX"
  3. Begin VB.Form LoginForm
  4. BackColor = &H00000000&
  5. BorderStyle = 1 'Fixed Single
  6. Caption = "ACSE Login Client"
  7. ClientHeight = 2685
  8. ClientLeft = 45
  9. ClientTop = 330
  10. ClientWidth = 6180
  11. LinkTopic = "Form1"
  12. MaxButton = 0 'False
  13. MinButton = 0 'False
  14. ScaleHeight = 2685
  15. ScaleWidth = 6180
  16. StartUpPosition = 3 'Windows Default
  17. Begin MSWinsockLib.Winsock Winsock1
  18. Left = 0
  19. Top = 0
  20. _ExtentX = 741
  21. _ExtentY = 741
  22. _Version = 393216
  23. Protocol = 1
  24. LocalPort = 9857
  25. End
  26. Begin VB.TextBox ServerName
  27. Height = 285
  28. Left = 1320
  29. MaxLength = 21
  30. TabIndex = 7
  31. Text = "127.0.0.1:9002"
  32. Top = 2220
  33. Width = 1935
  34. End
  35. Begin VB.TextBox LoginPassword
  36. BeginProperty Font
  37. Name = "MS Sans Serif"
  38. Size = 12
  39. Charset = 0
  40. Weight = 400
  41. Underline = 0 'False
  42. Italic = 0 'False
  43. Strikethrough = 0 'False
  44. EndProperty
  45. Height = 375
  46. Left = 3240
  47. MaxLength = 20
  48. TabIndex = 5
  49. Top = 1200
  50. Width = 2535
  51. End
  52. Begin VB.TextBox LoginName
  53. BeginProperty Font
  54. Name = "MS Sans Serif"
  55. Size = 12
  56. Charset = 0
  57. Weight = 400
  58. Underline = 0 'False
  59. Italic = 0 'False
  60. Strikethrough = 0 'False
  61. EndProperty
  62. Height = 375
  63. Left = 3240
  64. MaxLength = 20
  65. TabIndex = 3
  66. Top = 480
  67. Width = 2535
  68. End
  69. Begin VB.CommandButton SendPassword
  70. Caption = "Send"
  71. Height = 375
  72. Left = 3600
  73. TabIndex = 1
  74. Top = 2160
  75. Width = 1095
  76. End
  77. Begin VB.CommandButton Close
  78. Caption = "Close"
  79. Height = 375
  80. Left = 4920
  81. TabIndex = 0
  82. Top = 2160
  83. Width = 1095
  84. End
  85. Begin VB.Label Label3
  86. BackStyle = 0 'Transparent
  87. Caption = "Server IP:Port:"
  88. ForeColor = &H00FFFFFF&
  89. Height = 255
  90. Left = 120
  91. TabIndex = 6
  92. Top = 2280
  93. Width = 1215
  94. End
  95. Begin VB.Label Label2
  96. BackColor = &H00000000&
  97. BackStyle = 0 'Transparent
  98. Caption = "Password:"
  99. BeginProperty Font
  100. Name = "Tahoma"
  101. Size = 24
  102. Charset = 0
  103. Weight = 400
  104. Underline = 0 'False
  105. Italic = 0 'False
  106. Strikethrough = 0 'False
  107. EndProperty
  108. ForeColor = &H00FFFFFF&
  109. Height = 615
  110. Left = 360
  111. TabIndex = 4
  112. Top = 1080
  113. Width = 2775
  114. End
  115. Begin VB.Label Label1
  116. BackColor = &H00000000&
  117. BackStyle = 0 'Transparent
  118. Caption = "Login Name:"
  119. BeginProperty Font
  120. Name = "Tahoma"
  121. Size = 24
  122. Charset = 0
  123. Weight = 400
  124. Underline = 0 'False
  125. Italic = 0 'False
  126. Strikethrough = 0 'False
  127. EndProperty
  128. ForeColor = &H00FFFFFF&
  129. Height = 615
  130. Left = 360
  131. TabIndex = 2
  132. Top = 360
  133. Width = 2775
  134. End
  135. End
  136. Attribute VB_Name = "LoginForm"
  137. Attribute VB_GlobalNameSpace = False
  138. Attribute VB_Creatable = False
  139. Attribute VB_PredeclaredId = True
  140. Attribute VB_Exposed = False
  141. Option Base 0
  142. Option Explicit
  143. Private Sub Close_Click()
  144. End
  145. End Sub
  146. Private Sub Form_Load()
  147. 'Check Registry for Login/Server
  148. ServerName.Text = GetSetting("ACSE Login Client", "Settings", "Server")
  149. LoginName.Text = GetSetting("ACSE Login Client", "Settings", "LoginName")
  150. If ServerName.Text = "" Then ServerName.Text = "127.0.0.1:9002"
  151. End Sub
  152. Private Sub SendPassword_Click()
  153. On Error GoTo lala
  154. SaveSetting "ACSE Login Client", "Settings", "Server", ServerName.Text
  155. SaveSetting "ACSE Login Client", "Settings", "LoginName", LoginName.Text
  156. Dim Login(20) As Byte, Password(20) As Byte
  157. Dim SendString(&H18& + 40) As Byte
  158. Dim tpl As String, i As Integer
  159. For i = 0 To &H18& + 40 - 1
  160. SendString(i) = 0
  161. Next i
  162. For i = 0 To 19
  163. Login(i) = 0
  164. Password(i) = 0
  165. Next i
  166. For i = 0 To Len(LoginName.Text) - 1
  167. Login(i) = Asc(Mid(LoginName.Text, i + 1, 1))
  168. Next i
  169. For i = 0 To Len(LoginPassword.Text) - 1
  170. Password(i) = Asc(Mid(LoginPassword.Text, i + 1, 1))
  171. Next i
  172. SendString(4) = &H55&
  173. SendString(5) = &H34&
  174. SendString(6) = &H1&
  175. SendString(7) = &H0&
  176. For i = 0 To 19
  177. SendString(&H18& + i) = Login(i)
  178. SendString(&H18& + 20 + i) = Password(i)
  179. Next i
  180. 'Okay, packet is set up... Time to send...
  181. Dim Server As String, Port As Integer
  182. Server = ServerName.Text
  183. For i = 0 To Len(Server) - 1
  184. If Mid(Server, i + 1, 1) = ":" Then
  185. Port = Val(Right(Server, Len(Server) - i - 1))
  186. Server = Left(Server, i)
  187. i = Len(Server)
  188. End If
  189. Next i
  190. Winsock1.Close
  191. Winsock1.RemoteHost = Server
  192. Winsock1.RemotePort = Port
  193. Winsock1.SendData SendString
  194. Winsock1.Close
  195. Exit Sub
  196. lala:
  197. MsgBox "Error: " + Err.Source + " - " + Err.Description + " - " + Str(Err.LastDllError)
  198. End Sub