anhdh

Untitled

Jun 26th, 2016
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 3.83 KB | None | 0 0
  1. #include <ButtonConstants.au3>
  2. #include <EditConstants.au3>
  3. #include <GUIConstantsEx.au3>
  4. #include <StaticConstants.au3>
  5. #include <TabConstants.au3>
  6. #include <WindowsConstants.au3>
  7. #include <GUIListBox.au3>
  8. #include <WindowsConstants.au3>
  9. #include <Winhttp.au3>
  10. #include <Array.au3>
  11. #include <Zlib.au3>
  12. #include <Date.au3>
  13. #include <File.au3>
  14. ;~ Global Const $HTTP_STATUS_OK = 200
  15.  
  16. Global Const $HOST = 'http://toolregptc.esy.es'
  17.  
  18. $Form1 = GUICreate("GUI", 403, 236, 192, 124)
  19. $Tab1 = GUICtrlCreateTab(8, 8, 385, 217)
  20. GUICtrlCreateTabItem("Đăng nhập")
  21. GUICtrlSetState(-1,$GUI_SHOW)
  22. GUICtrlCreateLabel("Tài khoản:", 64, 72, 55, 17)
  23. GUICtrlCreateLabel("Mật khẩu:", 64, 104, 52, 17)
  24. $login_acc = GUICtrlCreateInput("", 120, 72, 185, 21)
  25. $login_pass = GUICtrlCreateInput("", 128, 104, 185, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
  26. $Button_login = GUICtrlCreateButton("Đăng nhập", 144, 144, 75, 25)
  27. GUICtrlCreateTabItem("Đăng ký")
  28.  
  29. GUICtrlCreateLabel("Tài khoản:", 72, 80, 55, 17)
  30. GUICtrlCreateLabel("Mật khẩu:", 72, 104, 52, 17)
  31. GUICtrlCreateLabel("Tên của bạn:", 72, 128, 68, 17)
  32. $reg_acc = GUICtrlCreateInput("", 152, 80, 169, 21)
  33. $reg_pass = GUICtrlCreateInput("", 152, 104, 169, 21, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD))
  34. $reg_name = GUICtrlCreateInput("", 152, 128, 169, 21)
  35. $Button_reg = GUICtrlCreateButton("Đăng ký", 160, 168, 75, 25)
  36. GUICtrlCreateTabItem("")
  37. GUISetState(@SW_SHOW)
  38.  
  39.  
  40. #Region Bien
  41. Local $stt = 1
  42. Local $sttAccount = 0
  43. Global $iCheckbox1 = 0
  44. Global $iCheckUser = 0
  45.  
  46. #EndRegion
  47.  
  48. While 1
  49.     $nMsg = GUIGetMsg()
  50.     Switch $nMsg
  51.         Case $Button_login
  52.             if GUICtrlRead($login_acc) <> '' and GUICtrlRead($login_pass) <> '' Then
  53.                 Local $post = HttpPost($HOST&'/login.php','user='& GUICtrlRead($login_acc) &'&pass='&GUICtrlRead($login_pass))
  54.                 if $post == 'WRONG' Then
  55.                     MsgBox(16,'Error','Sai pass hoặc tk')
  56.                 Elseif $post == 'CANTCONNECT' Then
  57.                     MsgBox(16,'Error','Không thể kết nỗi với dữ liệu')
  58.                 Else
  59.                     $tach = StringSplit($post,'-')
  60.                     if $tach[1] ==  'OK' Then
  61.                         $soAcc = BinaryToString($tach[2],4)
  62.                         $thongBao = BinaryToString($tach[3],4)
  63.                         $thongBaoTuAdmin = BinaryToString($tach[4],4)
  64.                         If $thongBao = "Run" Then
  65.                             GUIDelete()
  66.                             _Form2()
  67. ;~                          GUISetState($Form1 , @SW_HIDE)
  68.                         Else
  69.  
  70.                             MsgBox(0 , "Thông Báo" , "Bạn Không được sử dụng Phần mềm" )
  71.                             Exit
  72.                         EndIf
  73.  
  74.                     Else
  75.                         MsgBox(16,'Error',$post)
  76.                     EndIf
  77.                 EndIf
  78.             Else
  79.                 MsgBox(16,'Error','Vui lòng nhập đủ thông tin trên')
  80.                 GUICtrlSetData($login_acc , "" )
  81.                 GUICtrlSetData($login_pass , "" )
  82.             EndIf
  83.         Case $Button_reg
  84.             if GUICtrlRead($reg_acc) <> '' and GUICtrlRead($reg_pass) <> '' and GUICtrlRead($reg_name) <> '' Then
  85.                 Local $post = HttpPost($HOST&'/reg.php','user='&GUICtrlRead($reg_acc)&'&pass='&GUICtrlRead($reg_pass)&'&name='&StringToBinary(GUICtrlRead($reg_name),4))
  86.                 if $post == 'DONE' Then
  87.                     MsgBox(64,'Thành công','Thành công')
  88.                 Elseif $post == 'EXIST' Then
  89.                     MsgBox(48,'Lỗi','Tài khoản đã tồn tại')
  90.                 Else
  91.                     MsgBox(16,'Error',$post)
  92.                 EndIf
  93.             Else
  94.                 MsgBox(16,'Error','Vui lòng nhập đủ thông tin trên')
  95.             EndIf
  96.         Case $GUI_EVENT_CLOSE
  97.             Exit
  98.  
  99.     EndSwitch
  100. WEnd
  101.  
  102. Func HttpPost($sURL, $sData = "")
  103. Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
  104.  
  105. $oHTTP.Open("POST", $sURL, False)
  106. If (@error) Then Return SetError(1, 0, 0)
  107.  
  108. $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded")
  109.  
  110. $oHTTP.Send($sData)
  111. If (@error) Then Return SetError(2, 0, 0)
  112.  
  113. If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0)
  114.  
  115. Return SetError(0, 0, $oHTTP.ResponseText)
  116. EndFunc
  117.  
  118.  
  119. Func _Form2()
  120.     ;;Giao Diện chính của phần mềm
  121. EndFunc
  122.  
  123.  
  124. và các func khác nằm dưới này
Advertisement
Add Comment
Please, Sign In to add comment