Jump to content

Simple Login ( Username and Password )


10031992
 Share

Recommended Posts

To whom was the request of my login script is

How many sent me PM asking for my login script to program

then i decided post

My Script :

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>;
#include <EditConstants.au3>


ProgressOn("Load Program", "Open Program", "0%"); Just to let more beautiful
For $i = 10 To 100 Step 10
    Sleep(1000)
    ProgressSet($i, $i & "%")
Next
ProgressSet(100, "Full Load", "Complete")
Sleep(500)
ProgressOff()

$Form1 = GUICreate("Login", 400, 250, -1, -1); begining of Login
$PASSWORD = GUICtrlCreateInput("", 65, 167, 220, 21, BitOR($ES_PASSWORD,$ES_AUTOHSCROLL))
$ButtonOk = GUICtrlCreateButton("&OK", 200, 220, 75, 25, 0)
$ButtonCancel = GUICtrlCreateButton("&Cancel", 280, 220, 75, 25, 0)
$passwordlabel = GUICtrlCreateLabel("Password:", 8, 172, 50, 17)
$usernamelabel = GUICtrlCreateLabel("Username:", 8, 143, 52, 17)
$USERNAME = GUICtrlCreateInput("", 65, 144, 220, 21)
GUICtrlCreateGroup('',10,2,380,100)
        GUICtrlCreateLabel('Terms of use of this Software',30,10,340,18)
        GUICtrlSetColor(-1, 0x0012FF)
        GUICtrlSetFont(-1,12,400)
        GUICtrlCreateLabel('To use this software to be Registered in Forum',30,28,340,18)
        GUICtrlSetFont(-1,12,400)
        GUICtrlCreateLabel('',30,46,340,18)
        GUICtrlSetFont(-1,12,400)
        GUICtrlCreateLabel('To open the program',30,64,340,18)
        GUICtrlSetFont(-1,12,400)
        GUICtrlCreateLabel('Team gOHc Thank you for your choice',30,82,340,18)
        GUICtrlSetFont(-1,12,400)
    GUICtrlCreateGroup('',-99,-99,1,1)
    GUICtrlSetBkColor(-1,0x000000)
GUISetState(@SW_SHOW)



While 1
    $MSG = GUIGetMsg()
    Switch $MSG
    Case $ButtonOk
        If VerifyLogin(GUICtrlRead($USERNAME),GUICtrlRead($PASSWORD)) = 1 Then
            GUIDelete($Form1)
            MsgBox(-1,"Logado com Sucesso","Login Succ..")
            RunP()


        Else
            MsgBox(-1,"Error"," Username ou Senha está incorreto, Tente denovo")
        EndIf
    Case -3
        Exit
    Case $ButtonCancel
        Exit
    EndSwitch
WEnd

Func VerifyLogin($USERNAME,$PASSWORD)
    If $USERNAME = "your user here" And $PASSWORD = "your pass here" Then
        Return 1
    Else
        Return 0
    EndIf
EndFunc; End login



Func Runp()

;Your Code begining here
EndFunc

Func onautoitexit()
   Exit
EndFunc ;==>onautoitexit

Use so that you feel better

SimplesLogin.au3

Edited by 10031992

-------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program

Link to comment
Share on other sites

  • 1 month later...

how would u add this to this code?

it uses a login php u upload to a site

; ----------------------------------------------------------------------------
; ----------------------------------------------------------------------------
;
; Author:
;   Malu05 aka. Mads Hagbart Lund <mads@madx.dk>
;
; Script Function:
;   Login Script
;
; Notes:
; 
; ----------------------------------------------------------------------------
; ----------------------------------------------------------------------------

;;================================================================================
;;INCLUDES
;;================================================================================
#include <INet.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>

;;================================================================================
;;VARIABEL DEFINITION
;;================================================================================
$WebFileLoc = "http://www.madx.dk/files/login.php"      ;Put the link to the login file here.

;;================================================================================
;;GUI CREATION
;;================================================================================
$Login = GUICreate("Login",220,100)                                                                 ; //Create the login window
$User = GUICtrlCreateInput("Username",10,10)                                                        ; //Create the Username Input
$Pass = GUICtrlCreateInput("Password",10,40,-1,-1,$ES_PASSWORD)                                     ; //Create the Password Input
$OKbutton = GUICtrlCreateButton("Login",110,70,100)                                                 ; //Create the Login Button
$Exit = GUICtrlCreateButton("Exit",10,70,100)                                                       ; //Create the Exit Button
GUISetState()                                                                                       ; //Display the GUI

;;================================================================================
;;LOGIN LOOP
;;================================================================================
While 1                                                                                             ; //Initialize loop
    $msg = GUIGetMsg()                                                                              ; //Recive Input
    Select
        Case $msg = $GUI_EVENT_CLOSE or $msg = $Exit                                                ; //If the Exit or Close button is clicked, close the app.
            MsgBox(0, "Terminate", "Adios")                                                         ; //Say goodbye
            Exit                                                                                    ; //Exit the Application
        Case $msg = $OKbutton                                                                       ; //If the Login button is clicked goto the login function
            _login()
    EndSelect
WEnd

;;================================================================================
;;_login()
;;================================================================================
func _login()
$UsernameInput = GUICtrlRead($User)                                                                 ; //Get the username from the Input
$PasswordInput = GUICtrlRead($Pass)                                                                 ; //Get the password from the Input
if $UsernameInput = "" or $PasswordInput = "" Then                                                  ; //Check if the user forgot to put in username and/or password_
    MsgBox(0,"ERROR","Please Enter a Username and Password")                                        ;       -> Then Print this error 
Else
    $WEBdata = _INetGetSource($WebFileLoc &'?user=' & $UsernameInput & '&pass=' & $PasswordInput)   ; //Get the data from the PHP file
    
    if $WEBdata = "02" Then                                 ; //Check for Error outputs_
        MsgBox(0,"Error","Unable to Login" & @lf & "Username and or Password was incorrect")        ;->Display error output
    ElseIf $WEBdata ="0102" Then        
        MsgBox(0,"Error","Unable to Login" & @lf & "Password was incorrect")                        ;->Display error output
    Else                                                                                            
        msgbox(0,"Welcome","Welcome" & @lf & "data = " & StringTrimRight($WEBdata,2))               ; //Login Sucessfull. Post data.
    EndIf
EndIf
EndFunc ;--> _login()

LoginSystem.zip

Link to comment
Share on other sites

can u make it so it reads the user name and password of a .txt on the internet?

Yes, I modified my that the use, but more

Exemple:

http://yoursite.com/login.txt

File .txt

usuario|pass1

usuario2|pass2

.....

Func VerifyLogin($USERNAME,$PASSWORD)
local $x = 1
Do
inetget("http://yoursite.com/login.txt",@systemdir & "/login.txt")
$login = filereadline(@systemdir & "/login.txt",$x)
$string = stringsplit($login,"|")
if $string[1] = $username and $string[2] = $password then
return 1
exitloop
Else
$x = $x + 1
Endif
if $login = "" then
return 0
exitloop
endif
until $x = $x + 1
EndFunc
Edited by 10031992

-------------------------------------------------------------------------------------------------------------------------------------------- [center][/center][center]Autoit Support Forum in Portuguese | AutoitBrasil.com[/center] [sub]My Script :[/sub]Simples Login for Program

Link to comment
Share on other sites

  • 1 year later...
  • 8 months later...
  • 5 years later...
  • Developers
3 hours ago, Fhelipe said:

how to put multi logins?

Is this an actual question that you expect an answer for?
Maybe you could start with explaining what exactly you want to do first?

Jos
 

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

3 minutes ago, Jos said:

Is this an actual question that you expect an answer for?
Maybe you could start with explaining what exactly you want to do first?

Jos
 

I want to make a package for an application but I will distribute then I want the login system, as they are for more than one person wanted to put more logins

Link to comment
Share on other sites

  • Developers

Still not much to go on: How do you define these userids and Passwords for the script?
Why is the question posted in this thread as this shows a giu with a USerid&Password prompt so what is your problem implementing it based on this script example?

Jos

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

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...