Jump to content
Sign in to follow this  
Makiix3

Problems with Password check

Recommended Posts

Makiix3

So here is what i want to do:

I want to create a password check that shows up for example a message whenever i type in the correct password. After that it should Exit.

Also whenver i press cancel the programm should escape too.

Can any1 tell what´s wrong with my code?

$i = InputBox("Passwordcheck","Insert Password","","*")
If $i = "hlMG83csk" Then
    MsgBox(0,"Sucess","Correct Password")
    Exit
ElseIf $i = 2 Then
    Exit
ElseIf $i <> "hlMG83csk" Or 2 Then
    $x = InputBox("Passwordcheck","Wrong Password.Try Again!","","*")
EndIf
If $x = "hlMG83csk" Then
    MsgBox(0,"Sucess","Correct Password")
    Exit
ElseIf $x <> "hlMG83csk" Or 2 Then
    Do
    Inputbox("Passwordcheck","Wrong Password.Try Again!","","*")
Until $x = "hlMG83csk"
    Msgbox(0,"Sucess","Correct Password")
    Exit
    EndIf

PS: hlMG83csk is the password 2 is stands only for Cancel but I´m not sure if it´s right formulated.

Edited by Makiix3

Share this post


Link to post
Share on other sites
guinness

I would read the Forum Rules first as the title of the InputBox is a little suggestive.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
Makiix3

Sry i did not know about that. It was just some random title.

Thx for your advice.

Share this post


Link to post
Share on other sites
hannes08

Hi Makiix,

first, you don't need two "if .. then .. elseif .. then .. endif" constructs. One should be enough.

Second, strip the last elseif to else, because it already checked whether your input is 2 or the correct password.

Third, storing clear-text passwords is never a good idea. Better would be using hashes or encryption.

:)


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites
Makiix3

Thx for your fast response.

But get syntax error if i change the last ElseIf to Else.

C:\Users\Max\****\*******.au3(13,7) : ERROR: syntax error

Else $x

~~~~~^

C:\Users\Max\****\*******.au3 - 1 error(s), 0 warning(s)

Share this post


Link to post
Share on other sites
hannes08

;One time check:
$i = InputBox("Passwordcheck","Insert Password","","*")
If $i = "hlMG83csk" Then
    MsgBox(0,"Sucess","Correct Password")
    Exit
ElseIf $i = 2 Then
    Exit
Else
    $x = InputBox("Passwordcheck","Wrong Password.Try Again!","","*")
EndIf

;Two time check
For $i = 0 To 1
    $i = InputBox("Passwordcheck","Insert Password","","*")
    If $i = "hlMG83csk" Then
        MsgBox(0,"Sucess","Correct Password")
        Exit
    ElseIf $i = 2 Then
        Exit
    Else
        $x = InputBox("Passwordcheck","Wrong Password.Try Again!","","*")
    EndIf   
Next

;Continious check
While 1
    $i = InputBox("Passwordcheck","Insert Password","","*")
    If $i = "hlMG83csk" Then
        MsgBox(0,"Sucess","Correct Password")
        Exit
    ElseIf $i = 2 Then
        Exit
    Else
        $x = InputBox("Passwordcheck","Wrong Password.Try Again!","","*")
    EndIf   
WEnd

I suggest you to read the sections about loops and conditional statements in the helpfile. :)


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites
Makiix3

Still don´t work as it should but I´ll try to fixx it after rereading conditional statements and loops.

Thx anyways

Edited by Makiix3

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.