Jump to content
Sign in to follow this  
sarkar112

Simple login script

Recommended Posts

This is an example of a simple login script. I'm pretty sure it has a few bugs. But, dont flame me if its bad, because, I'm a newb. Hopefully, someone will fix this script and make a desent script out of it.

Global $username
Global $password
Global $muahahaha = InputBox( "username", "What is your username?", "", "")
Global $passwd = InputBox("password", "Enter your password.", "", "*")

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:        Sarkar112 <sarkar112@gmail.com/sarkar112@walla.com>
;
; Script Function:
;   To Learn From (A simple login example, Creates an inputbox that asks for ;username and password, If username and password is correct creates msgbox, if;incorrect, exits script)
; ----------------------------------------------------------------------------

_Login($muahahaha,$passwd)

Func _Login ($username,$password)
    If $username = "username" Then  
      If $password = "secret" Then
      MsgBox ( 1, "Correct", "Click OK to exit this script")
      Else
      MsgBox ( 1, "wrong", "Click OK to Exit this script")
      EndIf 
      EndIf
EndFunc

BTW: Can someone edit this and please make it bug-free. DO NOT FLAME ME!

EDIT: I forgot the inputbox =_=

EDIT2: Alot of errors fixed.

EDIT3: Script tested and two/three bugs fixed.

Edited by sarkar112

Share this post


Link to post
Share on other sites

Lar..... Did you make the flame and subsequent comment go away?

You are so kind. :-)

I was composing a reply to sarkar112, but could not decide if the original post was serious, so I went off to read all of sarkar112's other posts to "know my audience" and when I came back - well... things were different. :)

.....thanks.....


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

I think it is quite obvious that this is not a serious post/example.

<{POST_SNAPBACK}>

He stated he was a noob, so why go beatin' on him? :D:)

FootbaG

Share this post


Link to post
Share on other sites

So you *were* serious.

Does the code below do what you had in mind?

; --------------------------------------------------
;
; Script Function:
;    To Learn From A simple login example,
;    Creates an inputbox that asks for
;    username and password.
;    If username and password is correct
;    creates msgbox;
;    if, incorrect, exits script.
;
; --------------------------------------------------


$username = InputBox( "username", "What is your username?", "", "")
$password = InputBox("password", "Enter your password.", "", "*")

_Login()

Func _Login()
    If $username <> "username" Then Exit
    If $password <> "secret" Then Exit
    MsgBox(1, "Correct", "Click OK to exit this script")
EndFunc
Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

So you *were* serious.

Does the code below do what you had in mind?

; --------------------------------------------------
;
; Script Function:
;   To Learn From A simple login example,
;   Creates an inputbox that asks for
;   username and password.
;   If username and password is correct
;   creates msgbox;
;   if, incorrect, exits script.
;
; --------------------------------------------------
$username = InputBox( "username", "What is your username?", "", "")
$password = InputBox("password", "Enter your password.", "", "*")

_Login()

Func _Login()
    If $username <> "username" Then Exit
    If $password <> "secret" Then Exit
    MsgBox(1, "Correct", "Click OK to exit this script")
EndFunc

<{POST_SNAPBACK}>

I think... Its pretty much the same thing but shorter and easyer to understand.

Share this post


Link to post
Share on other sites

I think... Its pretty much the same thing but shorter and easyer to understand.

<{POST_SNAPBACK}>

Your description said, "if, incorrect, exits script" so I removed this

MsgBox ( 1, "wrong", "Click OK to Exit this script")

Is that what you intended or did you want a msgbox and then exit?

I did not change the flag of the msgbox from 1 to 0... perhaps you should change that. If you are not going to do anything with the cancel button, then I would not show it to the user.

Hope you had fun...


[size="1"][font="Arial"].[u].[/u][/font][/size]

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...