tuanvu Posted October 24, 2017 Share Posted October 24, 2017 Help me fix the source thank you I want to handle at the command If $check <> @error Then If $user <> $check[1][0] Then MsgBox(16, $title, "Tài khoảng không tồn tại", 3) #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $title = "[GUI] Login & Register" Global $file = @ScriptDir & "\data.ini" #Region ### START Koda GUI section ### Form= Global $Form = GUICreate($title, 308, 135, 352, 307) GUISetFont(10, 400, 0, "Arial") GUISetBkColor(0xFFFFFF) Global $Label_User = GUICtrlCreateLabel("Tài khoảng", 3, 8, 67, 20) Global $Label_Pass = GUICtrlCreateLabel("Mật khẩu", 3, 40, 58, 20) Global $Input_User = GUICtrlCreateInput("", 80, 5, 225, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) Global $Input_Pass = GUICtrlCreateInput("", 80, 37, 225, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_PASSWORD)) Global $Radio_Login = GUICtrlCreateRadio("Đăng nhập", 3, 72, 89, 25) GUICtrlSetState(-1, $GUI_CHECKED) Global $Radio_Reg = GUICtrlCreateRadio("Đăng ký", 3, 104, 89, 25) Global $Button = GUICtrlCreateButton("Đăng nhập", 130, 72, 130, 57) Dim $Form1_AccelTable[1][2] = [["{Enter}", $Button]] GUISetAccelerators($Form1_AccelTable) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Radio_Login GUICtrlSetData($Button, "Đăng nhập") Case $Radio_Reg GUICtrlSetData($Button, "Đăng ký") Case $Button If GUICtrlRead($Radio_Reg) = 1 Then _Reg() Else _Login() EndIf EndSwitch WEnd Func _Reg() $user = GUICtrlRead($Input_User) $pass = GUICtrlRead($Input_Pass) If StringLen($user) < 3 Then MsgBox(16, $title, "Tài khoảng không được bé hơn 4 kí tự") ElseIf StringLen($pass) < 3 Then MsgBox(16, $title, "Mật khẩu không được bé hơn 4 kí tự") ElseIf $user = $pass Then MsgBox(16, $title, "Tài khoảng và mật khẩu không trùng nhau!") Else IniWrite($file, $user, $user, $pass) MsgBox(64, $title, "Đăng kí thành công!", 3) GUICtrlSetData($Input_User, "") GUICtrlSetData($Input_Pass, "") GUICtrlSetState($Radio_Login, 1) EndIf EndFunc Func _Login() $user = GUICtrlRead($Input_User) $pass = GUICtrlRead($Input_Pass) $check = IniReadSection($file, $user) If $check <> @error Then If $user <> $check[1][0] Then MsgBox(16, $title, "Tài khoảng không tồn tại", 3) ElseIf $pass <> $check[1][1] Then MsgBox(16, $title, "Sai mật khẩu", 3) ElseIf $user = $check[1][0] And $pass = $check[1][1] Then MsgBox(64, $title, "Đăng nhập thành công!", 3) Else EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
tuanvu Posted October 24, 2017 Author Share Posted October 24, 2017 Help me fix the source thank you I want to handle at the command If $check <> @error Then If $user <> $check[1][0] Then MsgBox(16, $title, "Tài khoảng không tồn tại", 3) expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $title = "[GUI] Login & Register" Global $file = @ScriptDir & "\data.ini" #Region ### START Koda GUI section ### Form= Global $Form = GUICreate($title, 308, 135, 352, 307) GUISetFont(10, 400, 0, "Arial") GUISetBkColor(0xFFFFFF) Global $Label_User = GUICtrlCreateLabel("Tài khoảng", 3, 8, 67, 20) Global $Label_Pass = GUICtrlCreateLabel("Mật khẩu", 3, 40, 58, 20) Global $Input_User = GUICtrlCreateInput("", 80, 5, 225, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) Global $Input_Pass = GUICtrlCreateInput("", 80, 37, 225, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_PASSWORD)) Global $Radio_Login = GUICtrlCreateRadio("Đăng nhập", 3, 72, 89, 25) GUICtrlSetState(-1, $GUI_CHECKED) Global $Radio_Reg = GUICtrlCreateRadio("Đăng ký", 3, 104, 89, 25) Global $Button = GUICtrlCreateButton("Đăng nhập", 130, 72, 130, 57) Dim $Form1_AccelTable[1][2] = [["{Enter}", $Button]] GUISetAccelerators($Form1_AccelTable) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Radio_Login GUICtrlSetData($Button, "Đăng nhập") Case $Radio_Reg GUICtrlSetData($Button, "Đăng ký") Case $Button If GUICtrlRead($Radio_Reg) = 1 Then _Reg() Else _Login() EndIf EndSwitch WEnd Func _Reg() $user = GUICtrlRead($Input_User) $pass = GUICtrlRead($Input_Pass) If StringLen($user) < 3 Then MsgBox(16, $title, "Tài khoảng không được bé hơn 4 kí tự") ElseIf StringLen($pass) < 3 Then MsgBox(16, $title, "Mật khẩu không được bé hơn 4 kí tự") ElseIf $user = $pass Then MsgBox(16, $title, "Tài khoảng và mật khẩu không trùng nhau!") Else IniWrite($file, $user, $user, $pass) MsgBox(64, $title, "Đăng kí thành công!", 3) GUICtrlSetData($Input_User, "") GUICtrlSetData($Input_Pass, "") GUICtrlSetState($Radio_Login, 1) EndIf EndFunc Func _Login() $user = GUICtrlRead($Input_User) $pass = GUICtrlRead($Input_Pass) $check = IniReadSection($file, $user) If $check <> @error Then If $user <> $check[1][0] Then MsgBox(16, $title, "Tài khoảng không tồn tại", 3) ElseIf $pass <> $check[1][1] Then MsgBox(16, $title, "Sai mật khẩu", 3) ElseIf $user = $check[1][0] And $pass = $check[1][1] Then MsgBox(64, $title, "Đăng nhập thành công!", 3) Else EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
tuanvu Posted October 24, 2017 Author Share Posted October 24, 2017 Help me fix the source thank you I want to handle at the command If $check <> @error Then If $user <> $check[1][0] Then MsgBox(16, $title, "Tài khoảng không tồn tại", 3) expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $title = "[GUI] Login & Register" Global $file = @ScriptDir & "\data.ini" #Region ### START Koda GUI section ### Form= Global $Form = GUICreate($title, 308, 135, 352, 307) GUISetFont(10, 400, 0, "Arial") GUISetBkColor(0xFFFFFF) Global $Label_User = GUICtrlCreateLabel("Tài khoảng", 3, 8, 67, 20) Global $Label_Pass = GUICtrlCreateLabel("Mật khẩu", 3, 40, 58, 20) Global $Input_User = GUICtrlCreateInput("", 80, 5, 225, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) Global $Input_Pass = GUICtrlCreateInput("", 80, 37, 225, 24, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER,$ES_PASSWORD)) Global $Radio_Login = GUICtrlCreateRadio("Đăng nhập", 3, 72, 89, 25) GUICtrlSetState(-1, $GUI_CHECKED) Global $Radio_Reg = GUICtrlCreateRadio("Đăng ký", 3, 104, 89, 25) Global $Button = GUICtrlCreateButton("Đăng nhập", 130, 72, 130, 57) Dim $Form1_AccelTable[1][2] = [["{Enter}", $Button]] GUISetAccelerators($Form1_AccelTable) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Radio_Login GUICtrlSetData($Button, "Đăng nhập") Case $Radio_Reg GUICtrlSetData($Button, "Đăng ký") Case $Button If GUICtrlRead($Radio_Reg) = 1 Then _Reg() Else _Login() EndIf EndSwitch WEnd Func _Reg() $user = GUICtrlRead($Input_User) $pass = GUICtrlRead($Input_Pass) If StringLen($user) < 3 Then MsgBox(16, $title, "Tài khoảng không được bé hơn 4 kí tự") ElseIf StringLen($pass) < 3 Then MsgBox(16, $title, "Mật khẩu không được bé hơn 4 kí tự") ElseIf $user = $pass Then MsgBox(16, $title, "Tài khoảng và mật khẩu không trùng nhau!") Else IniWrite($file, $user, $user, $pass) MsgBox(64, $title, "Đăng kí thành công!", 3) GUICtrlSetData($Input_User, "") GUICtrlSetData($Input_Pass, "") GUICtrlSetState($Radio_Login, 1) EndIf EndFunc Func _Login() $user = GUICtrlRead($Input_User) $pass = GUICtrlRead($Input_Pass) $check = IniReadSection($file, $user) If $check <> @error Then If $user <> $check[1][0] Then MsgBox(16, $title, "Tài khoảng không tồn tại", 3) ElseIf $pass <> $check[1][1] Then MsgBox(16, $title, "Sai mật khẩu", 3) ElseIf $user = $check[1][0] And $pass = $check[1][1] Then MsgBox(64, $title, "Đăng nhập thành công!", 3) Else EndIf EndIf EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 24, 2017 Moderators Share Posted October 24, 2017 tuanvu, Welcome to the AutoIt forums. But in future, please stick to just the one thread at a time. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
kylomas Posted October 24, 2017 Share Posted October 24, 2017 tuanvu, This statement makes no sense... If $check <> @error Then IniReadSection returns an array. @ERROR is set by the function to indicate status. From the Help file Return Value Success: a 2 dimensional array where element[n][0] is the key and element[n][1] is the value. Failure: sets the @error flag to non-zero if unable to read the section (The INI file may not exist or the section may not exist or is empty) kylomas Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now