Sign in to follow this  
Followers 0
ashley

password protection

10 posts in this topic

well im making a password protection...

I have been making if for the last 2 days...(yeah i know im slow... cus im new tho... i hope to speed up)

but someone beet me to it heres there link -link-

so i have been looking at that one... it helped me a little but now im stuck

so what my problem:

When i run my script.. it says password incorrect as soon as the script it loaded... and i dont know why...

this is to be used as a include...

here is my script:

#include <GUIConstants.au3>

$Productkey = "test2"; the Product key needed
$Contact = "Youremail@emailserver.com"
$Programname = "program name here"


Productkey()

Func Productkey()
If Not IsDeclared("InputBoxAnswer") Then Local $InputBoxAnswer
#Region ### START Koda GUI section ### Form=c:\documents and settings\windows\desktop\koda\forms\product key.kxf
$Form1 = GUICreate("Product Key", 277, 232, 193, 115, BitOR($WS_MINIMIZEBOX,$WS_DLGFRAME,$WS_GROUP,$WS_CLIPSIBLINGS), BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
GUISetBkColor(0x00FFFF)
$Label1 = GUICtrlCreateLabel("Please input your product key...", 32, 8, 221, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Example:", 32, 32, 47, 17)
$Label3 = GUICtrlCreateLabel("KH67-gh68-Hf9G-A1F5F", 32, 48, 192, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("(this is not a real product key)", 32, 72, 174, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$done = GUICtrlCreateButton("Done", 40, 152, 75, 25, 0, )
$Button1 = GUICtrlCreateButton("I don't have one/I can't find it", 56, 184, 155, 25, 0)
$InputBoxAnswer = GUICtrlCreateInput("", 40, 120, 201, 21)
GUICtrlSetLimit($InputBoxAnswer, 20)
$include = GUICtrlCreateLabel("You must include -'s... This is Case Sensitive", 32, 96, 213, 17)
$Exit = GUICtrlCreateButton("Exit", 168, 152, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###


Select
    
Case @Error = 0
    
        If $InputBoxAnswer = $Productkey Then
            MsgBox(1024,"Product key correct","You may now use " & $Programname); this is what you see if password is typed correct!
            GUIDelete($Form1)
        Else
            MsgBox(1024,"Product key incorrect", "Please try again... if you do not have a product key contact " & $Contact & " to get one"); this is what you see if password is typed incorrect!
            GUIDelete($Form1)
            Productkey()    
        EndIf

    
Case $Button1
            MsgBox(1024,"Need a Product key","Contact " & $Contact)
            GUIDelete($Form1)
            Productkey()
        
Case $Exit
            MsgBox(1024, "Goodbye", "Didn't you have one... Oh well come back when you do")
            Exit

EndSelect
EndFunc

Can anybody help me please...

Thanks in advance...

Share this post


Link to post
Share on other sites



I don't even know where to begin :whistle: That's not even a properly coded GUI, it runs on recursion, not a loop...oh my. I'll just paste a revised copy and you can compare the two.

#include <GUIConstants.au3>

$Productkey = "test2"; the Product key needed
$Contact = "Youremail@emailserver.com"
$Programname = "program name here"

$Form1 = GUICreate("Product Key", 277, 232, 193, 115, BitOR($WS_MINIMIZEBOX, $WS_DLGFRAME, $WS_GROUP, $WS_CLIPSIBLINGS), BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))
GUISetBkColor(0x00FFFF)
$Label1 = GUICtrlCreateLabel("Please input your product key...", 32, 8, 221, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Example:", 32, 32, 47, 17)
$Label3 = GUICtrlCreateLabel("KH67-gh68-Hf9G-A1F5F", 32, 48, 192, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("(this is not a real product key)", 32, 72, 174, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$done = GUICtrlCreateButton("Done", 40, 152, 75, 25, 0)
$Button1 = GUICtrlCreateButton("I don't have one/I can't find it", 56, 184, 155, 25, 0)
$InputBoxAnswer = GUICtrlCreateInput("", 40, 120, 201, 21)
GUICtrlSetLimit($InputBoxAnswer, 20)
$include = GUICtrlCreateLabel("You must include -'s... This is Case Sensitive", 32, 96, 213, 17)
$Exit = GUICtrlCreateButton("Exit", 168, 152, 75, 25, 0)

GUISetState(@SW_SHOW)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $Exit
            MsgBox(1024, "Goodbye", "Didn't you have one... Oh well come back when you do")
            Quit()
        Case $done
            Done()
        Case $Button1
            MsgBox(1024, "Need a Product key", "Contact " & $Contact)
    EndSwitch
    Sleep(10)
WEnd

Func Done()
    If GUICtrlRead($InputBoxAnswer) = $Productkey Then
        MsgBox(1024, "Product key correct", "You may now use " & $Programname); this is what you see if password is typed correct!
        Exit
    Else
        MsgBox(1024, "Product key incorrect", "Please try again... if you do not have a product key contact " & $Contact & " to get one"); this is what you see if password is typed incorrect!
    EndIf
EndFunc   ;==>Done

Func Quit()
    Exit
EndFunc   ;==>Quit

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

#include <GUIConstants.au3>

$Productkey = "test2"; the Product key needed
$Contact = "Youremail@emailserver.com"
$Programname = "program name here"


Productkey()

Func Productkey()
    If Not IsDeclared("InputBoxAnswer") Then Local $InputBoxAnswer
    #Region ### START Koda GUI section ### Form=c:\documents and settings\windows\desktop\koda\forms\product key.kxf
    $Form1 = GUICreate("Product Key", 277, 232, 193, 115, BitOR($WS_MINIMIZEBOX, $WS_DLGFRAME, $WS_GROUP, $WS_CLIPSIBLINGS), BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))
    GUISetBkColor(0x00FFFF)
    $Label1 = GUICtrlCreateLabel("Please input your product key...", 32, 8, 221, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Example:", 32, 32, 47, 17)
    $Label3 = GUICtrlCreateLabel("KH67-gh68-Hf9G-A1F5F", 32, 48, 192, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label4 = GUICtrlCreateLabel("(this is not a real product key)", 32, 72, 174, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $done = GUICtrlCreateButton("Done", 40, 152, 75, 25, 0)
    $Button1 = GUICtrlCreateButton("I don't have one/I can't find it", 56, 184, 155, 25, 0)
    $InputBoxAnswer = GUICtrlCreateInput("", 40, 120, 201, 21)
    GUICtrlSetLimit($InputBoxAnswer, 20)
    $include = GUICtrlCreateLabel("You must include -'s... This is Case Sensitive", 32, 96, 213, 17)
    $Exit = GUICtrlCreateButton("Exit", 168, 152, 75, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
        $msg = GUIGetMsg()
        Select

            Case $msg = $done
                
                If GUICtrlRead($InputBoxAnswer) = $Productkey Then
                    MsgBox(1024, "Product key correct", "You may now use " & $Programname); this is what you see if password is typed correct!
                    GUIDelete($Form1)
                Else
                    MsgBox(1024, "Product key incorrect", "Please try again... if you do not have a product key contact " & $Contact & " to get one"); this is what you see if password is typed incorrect!
                    GUIDelete($Form1)
                    Productkey()
                EndIf


            Case $msg = $Button1
                MsgBox(1024, "Need a Product key", "Contact " & $Contact)
                GUIDelete($Form1)
                Productkey()

            Case $msg = $Exit
                MsgBox(1024, "Goodbye", "Didn't you have one... Oh well come back when you do")
                Exit

        EndSelect
    WEnd
EndFunc   ;==>Productkey

--edit: Mike beat me to it :whistle:

Edited by Monamo

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>

$Productkey = "test2"; the Product key needed
$Contact = "Youremail@emailserver.com"
$Programname = "program name here"
Productkey()

Func Productkey()
    If Not IsDeclared("InputBoxAnswer") Then Local $InputBoxAnswer
    #Region ### START Koda GUI section ### Form=c:\documents and settings\windows\desktop\koda\forms\product key.kxf
    $Form1 = GUICreate("Product Key", 277, 232, 193, 115, BitOR($WS_MINIMIZEBOX, $WS_DLGFRAME, $WS_GROUP, $WS_CLIPSIBLINGS), BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))
    GUISetBkColor(0x00FFFF)
    $Label1 = GUICtrlCreateLabel("Please input your product key...", 32, 8, 221, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Example:", 32, 32, 47, 17)
    $Label3 = GUICtrlCreateLabel("KH67-gh68-Hf9G-A1F5F", 32, 48, 192, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label4 = GUICtrlCreateLabel("(this is not a real product key)", 32, 72, 174, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $done = GUICtrlCreateButton("Done", 40, 152, 75, 25, 0)
    $Button1 = GUICtrlCreateButton("I don't have one/I can't find it", 56, 184, 155, 25, 0)
    $InputBoxAnswer = GUICtrlCreateInput("", 40, 120, 201, 21)
    GUICtrlSetLimit($InputBoxAnswer, 20)
    $include = GUICtrlCreateLabel("You must include -'s... This is Case Sensitive", 32, 96, 213, 17)
    $Exit = GUICtrlCreateButton("Exit", 168, 152, 75, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
        $msg = GUIGetMsg()
        Select

            Case $msg = $done
                
                If GUICtrlRead($InputBoxAnswer) = $Productkey Then
                    MsgBox(1024, "Product key correct", "You may now use " & $Programname); this is what you see if password is typed correct!
                    GUIDelete($Form1)
                Else
                    MsgBox(1024, "Product key incorrect", "Please try again... if you do not have a product key contact " & $Contact & " to get one"); this is what you see if password is typed incorrect!
                    GUIDelete($Form1)
                    Productkey()
                EndIf
            Case $msg = $Button1
                MsgBox(1024, "Need a Product key", "Contact " & $Contact)
                GUIDelete($Form1)
                Productkey()

            Case $msg = $Exit
                MsgBox(1024, "Goodbye", "Didn't you have one... Oh well come back when you do")
                Exit

        EndSelect
    WEnd
EndFunc   ;==>Productkey

--edit: Mike beat me to it :whistle:

dude thanks.. i like urs better

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

problem...

when the correct productkey is typed... and done is pressed it says it can now be used... but... then it dont carry on with the script that i was included with...

oh yeah heres the script you gave me with a few alterations

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.2.0
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <GUIConstants.au3>

$Productkey = "test2"; the Product key needed
$Contact = "Youremail@emailserver.com"
$Programname = "program name here"


Productkey()

Func Productkey()
    If Not IsDeclared("InputBoxAnswer") Then Local $InputBoxAnswer
    #Region ### START Koda GUI section ### Form=c:\documents and settings\windows\desktop\koda\forms\product key.kxf
    $Form1 = GUICreate("Product Key", 277, 232, 193, 115, BitOR($WS_MINIMIZEBOX, $WS_DLGFRAME, $WS_GROUP, $WS_CLIPSIBLINGS), BitOR($WS_EX_TOOLWINDOW, $WS_EX_WINDOWEDGE))
    GUISetBkColor(0x00FFFF)
    $Label1 = GUICtrlCreateLabel("Please input your product key...", 32, 8, 221, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $Label2 = GUICtrlCreateLabel("Example:", 32, 32, 47, 17)
    $Label3 = GUICtrlCreateLabel("KH67-gh68-Hf9G-A1F5F", 32, 48, 192, 24)
    GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
    $Label4 = GUICtrlCreateLabel("(this is not a real product key)", 32, 72, 174, 17)
    GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
    $done = GUICtrlCreateButton("Done", 40, 152, 75, 25, 0)
    $Button1 = GUICtrlCreateButton("I don't have one", 56, 184, 155, 25, 0)
    $InputBoxAnswer = GUICtrlCreateInput("", 40, 120, 201, 21)
    GUICtrlSetLimit($InputBoxAnswer, 20)
    $include = GUICtrlCreateLabel("You must include -'s... This is Case Sensitive", 32, 96, 213, 17)
    $Exit = GUICtrlCreateButton("Exit", 168, 152, 75, 25, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
        $msg = GUIGetMsg()
        Select

            Case $msg = $done
                
                If GUICtrlRead($InputBoxAnswer) = $Productkey Then
                    MsgBox(1024, "Product key correct", "You may now use " & $Programname); this is what you see if password is typed correct!
                    GUIDelete($Form1)
                    Exit
                Else
                    MsgBox(1024, "Product key incorrect", "Please try again... if you do not have a product key contact " & $Contact & " to get one"); this is what you see if password is typed incorrect!
                    GUIDelete($Form1)
                    Productkey()
                EndIf


            Case $msg = $Button1
                MsgBox(1024, "Need a Product key", "Contact " & $Contact)
                GUIDelete($Form1)
                Productkey()

            Case $msg = $Exit
                MsgBox(1024, "Goodbye", "Didn't you have one... Oh well come back when you do")
                Exit

        EndSelect
    WEnd
EndFunc   ;==>Productkey

thanks

Edited by ashley

Share this post


Link to post
Share on other sites

After u tell the user the password is correct u need a shell execute of something to run the script. You say u will use it as an include are u testing it as an include?

Share this post


Link to post
Share on other sites

After u tell the user the password is correct u need a shell execute of something to run the script. You say u will use it as an include are u testing it as an include?

yes

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Maybe the exit is exiting both scripts? try an exitloop.

Edited by sccrstvn93

Share this post


Link to post
Share on other sites

Maybe the exit is exiting both scripts? try an exitloop.

dude thanks...

It worked... now how do i get it to only ask for the product key once per pc...

Also im working on this anyideas:

after 1 year askes for a new product key...

does this every year

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

you could make a hidden ini file and have the script check if the the ini exists and has the proper info. You could encrypt the string in the ini so it would be harder to fake. You could also store something in the registry. Then at the begining of the script have the script check for the ini or for the regedit. I think there is an example script for a trail software wrapper. You could look at that for help.

Edit: here it is http://www.autoitscript.com/forum/index.php?showtopic=49970

Edited by sccrstvn93

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  
Followers 0