Szhlopp Posted August 25, 2008 Share Posted August 25, 2008 (edited) Enjoy! expandcollapse popup#include <GUIConstants.au3> #include <String.au3> ; $login = _Login(@ScriptDir & '\Login.lin', "{11B614C8-240D-4A0D-8A8A-660CFFEAB439}") ; #FUNCTION# ==================================================================================================================== ; Name...........: _Login() ; Description ...: Creates a custom GUI to have the user login. ; Syntax.........: _Login($INIFileLocation, $EncryptionPassword [, $EncryptionLevel = 3 [, $LockoutTime = 5]]) ; Parameters ....: $INIFileLocation - Where the login information is saved. ; $EncryptionPassword - Additional security password. ; $EncryptionLevel - Optional: How many layers of encryption. ; $LockoutTime - Optional: Time (in seconds) the user has to wait after entering an invalid user/pass. ; ; Return values .: Success - Sets @Error to 0 and returns an array containing: ; [0] = Name the user logged in with. ; [1] = Password the user logged in with. ; ; Failure - Sets @Error to 1 and returns 0 ; ; Author ........: Szhlopp ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; =============================================================================================================================== Func _Login($INIFileLocation, $EncryptionPassword, $EncryptionLevel = 3, $LockoutTime = 5) Local $loginSuccess = False Local $aRet[2] $aRet[0] = 0 $aRet[1] = 0 Local $LoginGUI, $loginusername, $loginpassword, $loginlogin, $logincreate, _ $warnicon1, $warnicon2, $warnicon3, $statuslabel, $loggedinName, $loggedinPassword ; ------- Default Username ------ $defusername = IniRead($INIFileLocation, "Defaults", "Username", "") If $defusername = "" Then IniWrite($INIFileLocation, "Defaults", "Username", "") $defusername = @UserName EndIf ; ------------------------------- ; ------- GUI create ------------ $LoginGUI = GUICreate("Login", 302, 135) $loginusername = GUICtrlCreateCombo($defusername, 102, 21, 165, 21) GUICtrlCreateLabel("Username:", 30, 22, 55, 17) $loginpassword = GUICtrlCreateInput("", 102, 55, 165, 21, 32) GUICtrlCreateLabel("Password:", 30, 56, 53, 17) GUICtrlCreateGroup("Credentials", 6, 1, 286, 86) GUICtrlSetColor(-1, 0x0000ff) GUICtrlCreateGroup("", -99, -99, 1, 1) $loginlogin = GUICtrlCreateButton("Login", 5, 105, 88, 25, 0) GUICtrlSetState(-1, $GUI_DEFBUTTON) GUICtrlSetTip(-1, "Click here to login") $logincreate = GUICtrlCreateButton("Create", 206, 105, 88, 25, 0) GUICtrlSetTip(-1, "Don't have an account? Click here to create one!") ; ------------------------------- ; Default User ------------------------------------------------ $Usernames = IniReadSection($INIFileLocation, "Usernames") If @error <> 1 Then $Usernames_Length = UBound($Usernames) - 1 For $I = 1 To $Usernames_Length $split = StringSplit($Usernames[$I][1], "|") GUICtrlSetData($loginusername, _StringEncrypt(0, $split[1], $EncryptionPassword, $EncryptionLevel)) Next EndIf ; Icon/notifications ----------------------------------------------- $warnicon1 = GUICtrlCreateIcon("Shell32.dll", -132, 270, 22, 15, 15) GUICtrlSetState(-1, $GUI_HIDE) $warnicon2 = GUICtrlCreateIcon("Shell32.dll", -132, 270, 58, 15, 15) GUICtrlSetState(-1, $GUI_HIDE) $warnicon3 = GUICtrlCreateIcon("Shell32.dll", -145, 145, 95, 15, 15) GUICtrlSetState(-1, $GUI_HIDE) $statuslabel = GUICtrlCreateLabel("Successfully created!", 95, 118) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 Sleep(20) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $logincreate GUICtrlSetState($warnicon1, $GUI_HIDE) GUICtrlSetState($warnicon2, $GUI_HIDE) GUICtrlSetState($warnicon3, $GUI_HIDE) GUICtrlSetState($statuslabel, $GUI_HIDE) $loginUN = GUICtrlRead($loginusername) $loginPS = GUICtrlRead($loginpassword) If $loginUN = "" Then GUICtrlSetData($statuslabel, " Username is blank") GUICtrlSetState($statuslabel, $GUI_SHOW) GUICtrlSetState($warnicon1, $GUI_SHOW) ElseIf $loginPS = "" Then GUICtrlSetData($statuslabel, " Passsword is blank") GUICtrlSetState($statuslabel, $GUI_SHOW) GUICtrlSetState($warnicon2, $GUI_SHOW) Else $Usernames = IniReadSection($INIFileLocation, "Usernames") $Usernames_Length = UBound($Usernames) - 1 $I = 1 $error = 0 If $Usernames_Length >= 1 Then For $I = 1 To $Usernames_Length $split = StringSplit($Usernames[$I][1], "|") If $loginUN == _StringEncrypt(0, $split[1], $EncryptionPassword, $EncryptionLevel) Then $error = 1 ExitLoop EndIf Next EndIf If $error = 0 Then IniWrite($INIFileLocation, "Usernames", "Username" & Int($Usernames_Length) + 1, _StringEncrypt(1, $loginUN, $EncryptionPassword, $EncryptionLevel) & "|" & _StringEncrypt(1, $loginPS, $loginUN & $EncryptionPassword & $loginPS, $EncryptionLevel)) GUICtrlSetState($warnicon3, $GUI_SHOW) GUICtrlSetData($statuslabel, " Successfully created!") GUICtrlSetState($statuslabel, $GUI_SHOW) Else GUICtrlSetState($warnicon1, $GUI_SHOW) GUICtrlSetState($loginusername, $GUI_FOCUS) GUICtrlSetData($statuslabel, " Username in use!") GUICtrlSetState($statuslabel, $GUI_SHOW) EndIf EndIf Case $loginlogin $loginSuccess = False GUICtrlSetState($warnicon1, $GUI_HIDE) GUICtrlSetState($warnicon2, $GUI_HIDE) GUICtrlSetState($warnicon3, $GUI_HIDE) GUICtrlSetState($statuslabel, $GUI_HIDE) $loginUN = GUICtrlRead($loginusername) $loginPS = GUICtrlRead($loginpassword) $Usernames = IniReadSection($INIFileLocation, "Usernames") $Usernames_Length = UBound($Usernames) - 1 For $I = 1 To $Usernames_Length $split = StringSplit($Usernames[$I][1], "|") If $split[2] == _StringEncrypt(1, $loginPS, $loginUN & $EncryptionPassword & $loginPS, $EncryptionLevel) Then ; MsgBox(0, "", "Now logged in") GUICtrlSetState($warnicon3, $GUI_SHOW) GUICtrlSetData($statuslabel, " Now logged in") GUICtrlSetState($statuslabel, $GUI_SHOW) $loggedinName = $loginUN $loggedinPassword = $loginPS $loginSuccess = True Sleep(500) ExitLoop EndIf Next If $loginSuccess = False Then GUICtrlSetState($warnicon1, $GUI_SHOW) GUICtrlSetState($warnicon2, $GUI_SHOW) GUICtrlSetState($statuslabel, $GUI_SHOW) If $LockoutTime >=1 Then GUICtrlSetState($loginpassword, $GUI_DISABLE) GUICtrlSetState($loginusername, $GUI_DISABLE) For $I = 0 To $LockoutTime - 1 GUICtrlSetData($statuslabel, "Invalid User/Pass! - " & $LockoutTime - $I) Sleep(1000) Next GUICtrlSetState($loginpassword, $GUI_ENABLE) GUICtrlSetState($loginusername, $GUI_ENABLE) EndIf GUICtrlSetData($statuslabel, " Invalid User/Pass!") EndIf EndSwitch If $loginSuccess = True Then GUIDelete($LoginGUI) $aRet[0] = $loggedinName $aRet[1] = $loggedinPassword ExitLoop EndIf WEnd If $loginSuccess = True Then SetError(0) Return $aRet Else SetError(1) Return 0 EndIf EndFunc ;==>Login I forgot to mention this UDF can have a default login name: [Defaults] Username=Szhlopp This will load in your name as the default=) Edited August 25, 2008 by Szhlopp RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
Valuater Posted August 25, 2008 Share Posted August 25, 2008 (edited) Looks nice! ... I like the way it responds with no username or password inputted. 8) Edited August 25, 2008 by Valuater Link to comment Share on other sites More sharing options...
Szhlopp Posted August 25, 2008 Author Share Posted August 25, 2008 (edited) Looks nice! ... I like the way it responds with no username or password inputted.8)Thanks.Also thanks for the input. I may switch it, I may not Edited August 25, 2008 by Szhlopp RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
gseller Posted August 26, 2008 Share Posted August 26, 2008 I like it!! Looks the same as in your Password manager.. Very professional looking/acting.. Link to comment Share on other sites More sharing options...
Szhlopp Posted August 26, 2008 Author Share Posted August 26, 2008 I like it!! Looks the same as in your Password manager.. Very professional looking/acting.. Yep. It is... I kept seeing posts in the GHaS for some sort of 'login'. People were having trouble using a file to save the data. So I thought I would just make a few changes to my login function from the manager and post it up for people who can't get a login function to work. RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
gseller Posted August 26, 2008 Share Posted August 26, 2008 Very Nice! Hide that file you have it writing to and would take a while for a hacker to find it without breaking the code... I agree with Valuater, I like the way it responds... Link to comment Share on other sites More sharing options...
hot202 Posted August 9, 2009 Share Posted August 9, 2009 this is heaps good. how would u make it to read the user names and password from a website? Link to comment Share on other sites More sharing options...
hot202 Posted August 13, 2009 Share Posted August 13, 2009 how do u delete the user name Encryption? Link to comment Share on other sites More sharing options...
Szhlopp Posted August 14, 2009 Author Share Posted August 14, 2009 how do u delete the user name Encryption?It's kind of embedded in there, lol.I can modify it to work however you want though. Let me ask a few questions...1) Do you want ZERO encryption in the login?Yes?The user's password will not be protected at ALL. Is this okay?Do you still want it stored as a file someplace? Or should I go to the registry?no?I can easily add MD5 comparison, AES Encryption or any other hash/encrpytion method you can find on the forums. Would this be better?Szh RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
hot202 Posted August 14, 2009 Share Posted August 14, 2009 (edited) well i want to put the ini on a website so it reads it from there or downloads the ini everytime and deletes it after it logs in or something like that and also how do i add it to this script i have tryed but i get heaps of errors. expandcollapse popup; Special thanks to GaryFrost for updating this to work with AutoIt v3.2.12.0! #NoTrayIcon #include <GDIPlus.au3>; this is where the magic happens, people #include <GuiComboBox.au3> #include <File.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <ButtonConstants.au3> Opt("MustDeclareVars", 0) Global Const $AC_SRC_ALPHA = 1 ;~ Global Const $ULW_ALPHA = 2 Global $old_string = "", $runthis = "" Global $launchDir = @DesktopDir ; Load PNG file as GDI bitmap _GDIPlus_Startup() $pngSrc = @ScriptDir & "\LaunchySkin.png" $hImage = _GDIPlus_ImageLoadFromFile($pngSrc) ; Extract image width and height from PNG $width = _GDIPlus_ImageGetWidth($hImage) $height = _GDIPlus_ImageGetHeight($hImage) ; Create layered window $GUI = GUICreate("lod3n launcher", $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED) SetBitmap($GUI, $hImage, 0) ; Register notification messages GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() WinSetOnTop($GUI, "", 1) ;fade in png background For $i = 0 To 255 Step 10 SetBitmap($GUI, $hImage, $i) Next ; create child MDI gui window to hold controls ; this part could use some work - there is some flicker sometimes... $controlGui = GUICreate("ControlGUI", $width, $height, 0, 0, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $GUI) ; child window transparency is required to accomplish the full effect, so $WS_EX_LAYERED above, and ; I think the way this works is the transparent window color is based on the image you set here: GUICtrlCreatePic(@ScriptDir & "\grey.gif", 0, 0, $width, $height) GUICtrlSetState(-1, $GUI_DISABLE) ; just a text label GUICtrlCreateLabel("Type the name of a file on your desktop and press Enter", 50, 12, 140, 50) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(-1, 0xFFFFFF) ; combo box listing all items on desktop $Combo = GUICtrlCreateCombo("", 210, 12, 250, -1) GUICtrlSetFont($Combo, 12) ; set default button for Enter key activation - renders outside GUI window $goButton = GUICtrlCreateButton("Go", $width, $height, 10, 10, $BS_DEFPUSHBUTTON) GUISetState() ; get list of files on desktop, show in combobox $aFileList = _FileListToArray($launchDir) _ArraySort($aFileList, 0, 1) $FileList = _ArrayToString($aFileList, "|", 1) GUICtrlSetData($Combo, $FileList) AdlibEnable("GoAutoComplete", 1000); combo autocomplete every message loop = often incorrect While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $goButton $runthis = GUICtrlRead($Combo) ExitLoop EndSelect WEnd AdlibDisable() If $runthis <> "" Then If FileExists($launchDir & "\" & $runthis) Then Beep(1000, 50) Beep(2000, 50) _ShellExecute($runthis, "", $launchDir) EndIf EndIf GUIDelete($controlGui) ;fade out png background For $i = 255 To 0 Step -10 SetBitmap($GUI, $hImage, $i) Next ; Release resources _WinAPI_DeleteObject($hImage) _GDIPlus_Shutdown() Func GoAutoComplete() _GUICtrlComboBox_AutoComplete($Combo) EndFunc ;==>GoAutoComplete ; ==================================================================================================== ; Handle the WM_NCHITTEST for the layered window so it can be dragged by clicking anywhere on the image. ; ==================================================================================================== Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam) If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION EndFunc ;==>WM_NCHITTEST ; ==================================================================================================== ; SetBitMap ; ==================================================================================================== Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap ; I don't like AutoIt's built in ShellExec. I'd rather do the DLL call myself. Func _ShellExecute($sCmd, $sArg = "", $sFolder = "", $rState = @SW_SHOWNORMAL) $aRet = DllCall("shell32.dll", "long", "ShellExecute", _ "hwnd", 0, _ "string", "", _ "string", $sCmd, _ "string", $sArg, _ "string", $sFolder, _ "int", $rState) If @error Then Return 0 $RetVal = $aRet[0] If $RetVal > 32 Then Return 1 Else Return 0 EndIf EndFunc ;==>_ShellExecute Edited August 14, 2009 by MrParo Link to comment Share on other sites More sharing options...
hot202 Posted August 15, 2009 Share Posted August 15, 2009 can some 1 please help me to get it to worlk with my script? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 15, 2009 Developers Share Posted August 15, 2009 can some 1 please help me to get it to worlk with my script?Stop double posting and stick to your support thread! SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
hot202 Posted August 17, 2009 Share Posted August 17, 2009 im sorry i just really want to have a paassword so that i can changeit when i want so the people using the program will have to come bak to the fourm and see what the new password is Link to comment Share on other sites More sharing options...
evilelf Posted December 14, 2009 Share Posted December 14, 2009 (edited) This works something like you wanted... Just have it delete ' File.lin ' after login or before exit. Cant do all the work I like this very much! +1 expandcollapse popup#RequireAdmin #include <GUIConstants.au3> #include <String.au3> ; Local $myini = "http://autoittesting.webs.com/Login.lin" Local $GetFile = InetGet($myini, @SystemDir & '\Login.lin') $login = _Login(@SystemDir & '\Login.lin', "{11B614C8-240D-4A0D-8A8A-660CFFEAB439}") ; #FUNCTION# ==================================================================================================================== ; Name...........: _Login() ; Description ...: Creates a custom GUI to have the user login. ; Syntax.........: _Login($INIFileLocation, $EncryptionPassword [, $EncryptionLevel = 3 [, $LockoutTime = 5]]) ; Parameters ....: $INIFileLocation - Where the login information is saved. ; $EncryptionPassword - Additional security password. ; $EncryptionLevel - Optional: How many layers of encryption. ; $LockoutTime - Optional: Time (in seconds) the user has to wait after entering an invalid user/pass. ; ; Return values .: Success - Sets @Error to 0 and returns an array containing: ; [0] = Name the user logged in with. ; [1] = Password the user logged in with. ; ; Failure - Sets @Error to 1 and returns 0 ; ; Author ........: Szhlopp ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; =============================================================================================================================== Func _Login($INIFileLocation, $EncryptionPassword, $EncryptionLevel = 3, $LockoutTime = 5) Local $loginSuccess = False Local $aRet[2] $aRet[0] = 0 $aRet[1] = 0 Local $LoginGUI, $loginusername, $loginpassword, $loginlogin, $logincreate, _ $warnicon1, $warnicon2, $warnicon3, $statuslabel, $loggedinName, $loggedinPassword ; ------- Default Username ------ $defusername = IniRead($INIFileLocation, "Defaults", "Username", "") If $defusername = "" Then IniWrite($INIFileLocation, "Defaults", "Username", "") $defusername = @UserName EndIf ; ------------------------------- ; ------- GUI create ------------ $LoginGUI = GUICreate("Login", 302, 135) $loginusername = GUICtrlCreateCombo($defusername, 102, 21, 165, 21) GUICtrlCreateLabel("Username:", 30, 22, 55, 17) $loginpassword = GUICtrlCreateInput("", 102, 55, 165, 21, 32) GUICtrlCreateLabel("Password:", 30, 56, 53, 17) GUICtrlCreateGroup("Credentials", 6, 1, 286, 86) GUICtrlSetColor(-1, 0x0000ff) GUICtrlCreateGroup("", -99, -99, 1, 1) $loginlogin = GUICtrlCreateButton("Login", 5, 105, 88, 25, 0) GUICtrlSetState(-1, $GUI_DEFBUTTON) GUICtrlSetTip(-1, "Click here to login") $logincreate = GUICtrlCreateButton("Create", 206, 105, 88, 25, 0) GUICtrlSetTip(-1, "Don't have an account? Click here to create one!") ; ------------------------------- ; Default User ------------------------------------------------ $Usernames = IniReadSection($INIFileLocation, "Usernames") If @error <> 1 Then $Usernames_Length = UBound($Usernames) - 1 For $I = 1 To $Usernames_Length $split = StringSplit($Usernames[$I][1], "|") GUICtrlSetData($loginusername, _StringEncrypt(0, $split[1], $EncryptionPassword, $EncryptionLevel)) Next EndIf ; Icon/notifications ----------------------------------------------- $warnicon1 = GUICtrlCreateIcon("Shell32.dll", -132, 270, 22, 15, 15) GUICtrlSetState(-1, $GUI_HIDE) $warnicon2 = GUICtrlCreateIcon("Shell32.dll", -132, 270, 58, 15, 15) GUICtrlSetState(-1, $GUI_HIDE) $warnicon3 = GUICtrlCreateIcon("Shell32.dll", -145, 145, 95, 15, 15) GUICtrlSetState(-1, $GUI_HIDE) $statuslabel = GUICtrlCreateLabel("Successfully created!", 95, 118) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) While 1 Sleep(20) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ExitLoop Case $logincreate GUICtrlSetState($warnicon1, $GUI_HIDE) GUICtrlSetState($warnicon2, $GUI_HIDE) GUICtrlSetState($warnicon3, $GUI_HIDE) GUICtrlSetState($statuslabel, $GUI_HIDE) $loginUN = GUICtrlRead($loginusername) $loginPS = GUICtrlRead($loginpassword) If $loginUN = "" Then GUICtrlSetData($statuslabel, " Username is blank") GUICtrlSetState($statuslabel, $GUI_SHOW) GUICtrlSetState($warnicon1, $GUI_SHOW) ElseIf $loginPS = "" Then GUICtrlSetData($statuslabel, " Passsword is blank") GUICtrlSetState($statuslabel, $GUI_SHOW) GUICtrlSetState($warnicon2, $GUI_SHOW) Else $Usernames = IniReadSection($INIFileLocation, "Usernames") $Usernames_Length = UBound($Usernames) - 1 $I = 1 $error = 0 If $Usernames_Length >= 1 Then For $I = 1 To $Usernames_Length $split = StringSplit($Usernames[$I][1], "|") If $loginUN == _StringEncrypt(0, $split[1], $EncryptionPassword, $EncryptionLevel) Then $error = 1 ExitLoop EndIf Next EndIf If $error = 0 Then IniWrite($INIFileLocation, "Usernames", "Username" & Int($Usernames_Length) + 1, _StringEncrypt(1, $loginUN, $EncryptionPassword, $EncryptionLevel) & "|" & _StringEncrypt(1, $loginPS, $loginUN & $EncryptionPassword & $loginPS, $EncryptionLevel)) GUICtrlSetState($warnicon3, $GUI_SHOW) GUICtrlSetData($statuslabel, " Successfully created!") GUICtrlSetState($statuslabel, $GUI_SHOW) Else GUICtrlSetState($warnicon1, $GUI_SHOW) GUICtrlSetState($loginusername, $GUI_FOCUS) GUICtrlSetData($statuslabel, " Username in use!") GUICtrlSetState($statuslabel, $GUI_SHOW) EndIf EndIf Case $loginlogin $loginSuccess = False GUICtrlSetState($warnicon1, $GUI_HIDE) GUICtrlSetState($warnicon2, $GUI_HIDE) GUICtrlSetState($warnicon3, $GUI_HIDE) GUICtrlSetState($statuslabel, $GUI_HIDE) $loginUN = GUICtrlRead($loginusername) $loginPS = GUICtrlRead($loginpassword) $Usernames = IniReadSection($INIFileLocation, "Usernames") $Usernames_Length = UBound($Usernames) - 1 For $I = 1 To $Usernames_Length $split = StringSplit($Usernames[$I][1], "|") If $split[2] == _StringEncrypt(1, $loginPS, $loginUN & $EncryptionPassword & $loginPS, $EncryptionLevel) Then ; MsgBox(0, "", "Now logged in") GUICtrlSetState($warnicon3, $GUI_SHOW) GUICtrlSetData($statuslabel, " Now logged in") GUICtrlSetState($statuslabel, $GUI_SHOW) $loggedinName = $loginUN $loggedinPassword = $loginPS $loginSuccess = True Sleep(500) ExitLoop EndIf Next If $loginSuccess = False Then GUICtrlSetState($warnicon1, $GUI_SHOW) GUICtrlSetState($warnicon2, $GUI_SHOW) GUICtrlSetState($statuslabel, $GUI_SHOW) If $LockoutTime >=1 Then GUICtrlSetState($loginpassword, $GUI_DISABLE) GUICtrlSetState($loginusername, $GUI_DISABLE) For $I = 0 To $LockoutTime - 1 GUICtrlSetData($statuslabel, "Invalid User/Pass! - " & $LockoutTime - $I) Sleep(1000) Next GUICtrlSetState($loginpassword, $GUI_ENABLE) GUICtrlSetState($loginusername, $GUI_ENABLE) EndIf GUICtrlSetData($statuslabel, " Invalid User/Pass!") EndIf EndSwitch If $loginSuccess = True Then GUIDelete($LoginGUI) $aRet[0] = $loggedinName $aRet[1] = $loggedinPassword ExitLoop EndIf WEnd If $loginSuccess = True Then SetError(0) Return $aRet Else SetError(1) Return 0 EndIf EndFunc ;==>Login Edited December 14, 2009 by evilelf 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