Jump to content
Sign in to follow this  
do3z

Program Login

Recommended Posts

do3z

Hey guys.

I'm after something like. i open my program and pops up with username and password and when you type the username and password correctly it opens up my program so its like a login i know this is posted al over this forum but i carnt seem to find if someone could send me a link or help me out thanks.


Google Is For Real Men. Yahoo Is For Wimps!

Share this post


Link to post
Share on other sites
AzKay

I dont understand what you want; I looked at your "recent posts", and in nearly every of them, you have exactly what your asking here.


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites
z0mgItsJohn

Maybe This Is What Your Asking For..

* Hope It Helps * :)

Source : Example.Au3

#Include <GUIConstants.Au3>
#Include <Misc.Au3>
Opt ('GUIOnEventMode','1')
Opt ('WinTitleMatchMode','2')
Global $Username = 'Username'
Global $Password = 'Password'
Global $Secret_Text = 'AutoIt Rocks!'
Global $Void = False

$GUI = GUICreate ('Login Form (Example)','185','88','-1','-1','-1','128')
GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit')
GUICtrlCreateLabel ('Username : ','5','6','100','20')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlSetColor ('-1','0x000FF')
$Input_Username =  GUICtrlCreateInput ('','80','5','100','20','1')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlCreateLabel ('Password : ','7','35','100','20')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlSetColor ('-1','0x000FF')
$Input_Password =  GUICtrlCreateInput ('','80','34','100','20', BitOr ('0x0020','1'))
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
$Login_Button = GUICtrlCreateLabel ('Account Login','50','62','84','16')
GUICtrlSetBkColor ('-1', $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetOnEvent ('-1','_Login')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlSetColor ('-1','0xFFF000')
GUISetState (@SW_SHOW)

While '1'
Sleep ('15')
If _IsPressed ('0D') And WinActive ($GUI) And _Check () = '1' Then _Login ()
WEnd

Func _Check ()
$Focus = ControLGetFocus ($GUI)
If $Focus = 'Edit1' Or 'Edit2' Then Return '1'
EndFunc

Func _Login ()
$1 = GUICtrlRead ($Input_Username); Inputed Username
$2 = GUICtrlRead ($Input_Password); Inputed Password
; Check
If $1 = $Username And $2 == $Password Then 
MsgBox ('0','Secret Text!','Secret Text : ' & $Secret_Text, '0')
ElseIf $1 = $Username And $2 <> $Password Then 
MsgBox ('16','Error Code 01','Incorrect Password, Please Try Again','0')
ElseIf $1 <> $Username And $2 == $Password Then 
MsgBox ('16','Error Code 02','Incorrect Username, Please Try Again','0')
ElseIf $2 <> $Username And $2 <> $Password Then 
MsgBox ('16','Error Code 03','Incorrect Username And Password, Please Try Again','0')
EndIf 
Sleep ('500')
EndFunc

Func _Exit ()
Exit
EndFunc

- John


Latest Projects :- New & Improved TCP Chat

Share this post


Link to post
Share on other sites
GEOSoft

maybe this is what you were thinking of

http://www.autoitscript.com/forum/index.ph...amp;hl=password


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites
do3z

Maybe This Is What Your Asking For..

* Hope It Helps * :)

Source : Example.Au3

#Include <GUIConstants.Au3>
#Include <Misc.Au3>
Opt ('GUIOnEventMode','1')
Opt ('WinTitleMatchMode','2')
Global $Username = 'Username'
Global $Password = 'Password'
Global $Secret_Text = 'AutoIt Rocks!'
Global $Void = False

$GUI = GUICreate ('Login Form (Example)','185','88','-1','-1','-1','128')
GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit')
GUICtrlCreateLabel ('Username : ','5','6','100','20')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlSetColor ('-1','0x000FF')
$Input_Username =  GUICtrlCreateInput ('','80','5','100','20','1')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlCreateLabel ('Password : ','7','35','100','20')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlSetColor ('-1','0x000FF')
$Input_Password =  GUICtrlCreateInput ('','80','34','100','20', BitOr ('0x0020','1'))
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
$Login_Button = GUICtrlCreateLabel ('Account Login','50','62','84','16')
GUICtrlSetBkColor ('-1', $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetOnEvent ('-1','_Login')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlSetColor ('-1','0xFFF000')
GUISetState (@SW_SHOW)

While '1'
Sleep ('15')
If _IsPressed ('0D') And WinActive ($GUI) And _Check () = '1' Then _Login ()
WEnd

Func _Check ()
$Focus = ControLGetFocus ($GUI)
If $Focus = 'Edit1' Or 'Edit2' Then Return '1'
EndFunc

Func _Login ()
$1 = GUICtrlRead ($Input_Username); Inputed Username
$2 = GUICtrlRead ($Input_Password); Inputed Password
; Check
If $1 = $Username And $2 == $Password Then 
MsgBox ('0','Secret Text!','Secret Text : ' & $Secret_Text, '0')
ElseIf $1 = $Username And $2 <> $Password Then 
MsgBox ('16','Error Code 01','Incorrect Password, Please Try Again','0')
ElseIf $1 <> $Username And $2 == $Password Then 
MsgBox ('16','Error Code 02','Incorrect Username, Please Try Again','0')
ElseIf $2 <> $Username And $2 <> $Password Then 
MsgBox ('16','Error Code 03','Incorrect Username And Password, Please Try Again','0')
EndIf 
Sleep ('500')
EndFunc

Func _Exit ()
Exit
EndFunc

- John

yeah thats what i want thanks man but one more issue :$ sorry but its great and its what im after but i type username password and it opens like i want it to but it opens as a pop up message ?? i more wanted it to open up like a hole nother script like if i script a program now i want to password protect it how do i?


Google Is For Real Men. Yahoo Is For Wimps!

Share this post


Link to post
Share on other sites
atnextc

OK Since I was going to ask this exact same question.

I guess I"ll just add to it.

Is there a way to have more than one username and password? Say like 5 different ones?

Also is there a way to make this pop up in the event that someone tries to open notepad.exe for example?

I mean that I want this to pop up before notepad does if they login correctly and if they don't it won't open the program specified?

Thanks again.

#Include <GUIConstants.Au3>
#Include <Misc.Au3>
Opt ('GUIOnEventMode','1')
Opt ('WinTitleMatchMode','2')
Global $Username = 'Username'
Global $Password = 'Password'
Global $Secret_Text = 'Welcome To Atnex Tech Support Tool!'
Global $Void = False

$GUI = GUICreate ('Login Form ','185','88','-1','-1','-1','128')
GUISetOnEvent ($GUI_EVENT_CLOSE, '_Exit')
GUICtrlCreateLabel ('Username : ','5','6','100','20')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlSetColor ('-1','0x000FF')
$Input_Username =  GUICtrlCreateInput ('','80','5','100','20','1')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlCreateLabel ('Password : ','7','35','100','20')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlSetColor ('-1','0x000FF')
$Input_Password =  GUICtrlCreateInput ('','80','34','100','20', BitOr ('0x0020','1'))
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
$Login_Button = GUICtrlCreateLabel ('Account Login','50','62','84','16')
GUICtrlSetBkColor ('-1', $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetOnEvent ('-1','_Login')
GUICtrlSetFont ('-1','10','','','Microsoft Sans Serif')
GUICtrlSetColor ('-1','0xFFF000')
GUISetState (@SW_SHOW)

While '1'
Sleep ('15')
If _IsPressed ('0D') And WinActive ($GUI) And _Check () = '1' Then _Login ()
WEnd

Func _Check ()
$Focus = ControLGetFocus ($GUI)
If $Focus = 'Edit1' Or 'Edit2' Then Return '1'
EndFunc

Func _Login ()
$1 = GUICtrlRead ($Input_Username); Inputed Username
$2 = GUICtrlRead ($Input_Password); Inputed Password
; Check
If $1 = $Username And $2 == $Password Then
MsgBox ('0','Secret Text!','Secret Text : ' & $Secret_Text, '0')
ElseIf $1 = $Username And $2 <> $Password Then
MsgBox ('16','Error Code 01','Incorrect Password, Please Try Again','0')
ElseIf $1 <> $Username And $2 == $Password Then
MsgBox ('16','Error Code 02','Incorrect Username, Please Try Again','0')
ElseIf $2 <> $Username And $2 <> $Password Then
MsgBox ('16','Error Code 03','Incorrect Username And Password, Please Try Again','0')
EndIf
Sleep ('500')
EndFunc

Func _Exit ()
Exit
EndFunc
Edited by atnextc

Share this post


Link to post
Share on other sites
sloppyprogrammer

Isn't there a template for this in Koda? :S


[center]They say that there is only 10 kinds of people that understand binary code; those who do, and those who don't...[/center][center]Get it? :P[/center]

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  

×