Jump to content

Problem with my Authent function...


Recommended Posts

Hello :D

I have a probleme with my authentification function :

CODE
; A simple custom messagebox that uses the OnEvent mode

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Opt("GUIOnEventMode", 1)

Global $ExitID

_Main()

Func _Main()

Local $YesID, $NoID

GUICreate("SecureMyWeb - Admin", 210, 80)

GUICtrlCreateLabel("Choisissez une option", 10, 10)

$YesID = GUICtrlCreateButton("Paramètres", 10, 50, 70, 20)

GUICtrlSetOnEvent($YesID, "OnYes")

$ExitID = GUICtrlCreateButton("Fermer", 150, 50, 50, 20)

GUICtrlSetOnEvent($ExitID, "OnExit")

GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")

GUISetState() ; display the GUI

While 1

Sleep(1000)

WEnd

EndFunc ;==>_Main

;--------------- Functions ---------------

Func OnYes()

MsgBox(0, "Choisissez une option", "Paramètres")

EndFunc ;==>OnYes

Func OnExit()

If @GUI_CtrlId = $ExitID Then

_authentification()

Else

_authentification()

EndIf

Exit

EndFunc ;==>OnExit

Func _authentification()

;AUTHENTIFICATION

$text = InputBox("Authentification", "Enter your password :","","*")

If @error = 1 Then

MsgBox(4096, "Error", "You closed !")

Exit

Else

If $text <> "multing" Then

MsgBox(4096, "Errorr", "Wrong Password !")

Exit

Else

EndIf

EndIf

EndFunc

My problem is when i want to enter the password, error variable undefined $text....

Edited by sambalec
Link to comment
Share on other sites

; A simple custom messagebox that uses the OnEvent mode

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)

Global $ExitID



_Main()

Func _Main()
    Local $YesID, $NoID

    GUICreate("SecureMyWeb - Admin", 210, 80)

    GUICtrlCreateLabel("Choisissez une option", 10, 10)
    $YesID = GUICtrlCreateButton("Paramètres", 10, 50, 70, 20)
    GUICtrlSetOnEvent($YesID, "OnYes")
    $ExitID = GUICtrlCreateButton("Fermer", 150, 50, 50, 20)
    GUICtrlSetOnEvent($ExitID, "OnExit")

    GUISetOnEvent($GUI_EVENT_CLOSE, "OnExit")

    GUISetState() ; display the GUI

    While 1
        Sleep(1000)
    WEnd
EndFunc   ;==>_Main

;--------------- Functions ---------------
Func OnYes()
    MsgBox(0, "Choisissez une option", "Paramètres")
EndFunc   ;==>OnYes

Func OnExit()
    If @GUI_CtrlId = $ExitID Then
        _authentification()
    Else
        _authentification()
    EndIf

    Exit
EndFunc   ;==>OnExit

Func _authentification()

    Local $text
    ;AUTHENTIFICATION
    $text = InputBox("Authentification", "Enter your password :", "", "*")
    If @error = 1 Then
        MsgBox(4096, "Error", "You closed !")
        Exit
    Else
        If $text <> "multing" Then
            MsgBox(4096, "Errorr", "Wrong Password !")
            Exit
        Else

        EndIf
    EndIf

EndFunc   ;==>_authentification

Just needed to declare $text inside your function

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...