Jump to content

Recommended Posts

Posted (edited)

how do i add a password to my program that nobody else can access it without the password can anyone give me an example in source code please

Edited by Duffy
Posted

Easy:

$test=InputBox("Password","Write correct password:","","'")
If $test<>"password" Then Exit

Remember this is only secure if the people trying to use does not have knowledge about software engineering, please see this thread for more info :)

Broken link? PM me and I'll send you the file!

Posted

I found this code and it works better

#NoTrayIcon

_Login("My Password", "Please enter a password", "password")

Func _Login($Title, $Prompt, $Password, $MaxAttempts = 3)
    $Attempts = 0
    Do
        $InputBoxAnswer = InputBox($Title, $Prompt, "", "*M", "-1", "-1", "-1", "-1")
        Select
            Case @error = 0;OK - The string returned is valid
                If $InputBoxAnswer == $Password Then
                    MsgBox(1024, "Password was correct!", "You typed the correct Password. You may access this file!"); What to do if password was entered correctly!
                    Exit
                Else
                    If $Attempts < $MaxAttempts - 1 And $MaxAttempts <> 1 Then
                        MsgBox(1024, "Password was wrong!", "You typed the Wrong Password. You may try again " & ($MaxAttempts - 1) - $Attempts & " time(s)"); What to do if password was not entered correctly!
                    Else
                        MsgBox(1024, "Password was wrong!", "Sorry, You can not access this file!"); What to do if password was not entered correctly!
                    EndIf
                    $Attempts += 1
                  ;Exit
                EndIf
                
            Case @error = 1;The Cancel button was pushed
                Exit
        EndSelect
    Until $Attempts = $MaxAttempts Or $InputBoxAnswer == $Password

EndFunc ;==>Password

now i no how to add a password i just dont know how to run this script when i enter the correct one can anyone help please.

This is only and example script i just found

#include <GUIConstants.au3>
#include <IE.au3>


$oIE = _IECreateEmbedded ()
$Form1 = GUICreate("Are You a Human?", 500, 300)
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 500, 300)
GUISetState(@SW_SHOW)
_IENavigate ($oIE, "http://www.anythingweb.org/PHP/phpCaptcha/example1.php")

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
    Case $GUI_EVENT_CLOSE
        Exit
    EndSwitch
WEnd
Posted

A program will run the main loop in order of what is posted in your editor first.

#include <GUIConstants.au3>
#include <IE.au3>

$test=InputBox("Password","Write correct password:","","'")
If $test<>"password" Then Exit

$oIE = _IECreateEmbedded ()
$Form1 = GUICreate("Are You a Human?", 500, 300)

$oIE = _IECreateEmbedded ()
$GUIActiveX = GUICtrlCreateObj($oIE, 0, 0, 500, 300)
GUISetState(@SW_SHOW)
_IENavigate ($oIE, "http://www.anythingweb.org/PHP/phpCaptcha/example1.php")

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
    Case $GUI_EVENT_CLOSE
        Exit
    EndSwitch
WEnd

That will ask for a password then create the GUI.

Posted

This one will allow the user to set their own password

; password encrypter
; Author Valuater
 
If Not FileExists(@SystemDir & "\License.dat") Then
    $password = InputBox("Password *Set-up*", "  Please *Set-up* Your Password:", "", "", 200, 120)
    If @error = 1 Or $password = "" Then Exit
    FileWrite(@SystemDir & "\License.dat", _StringEncrypt(1, $password, @ComputerName & "4"))
Else
    $password = _StringEncrypt(0, FileReadLine(@SystemDir & "\License.dat", 1), @ComputerName & "4")
    If InputBox("Password Protected", "  Please Type in Your Password:", "", "*", 200, 120) <> $password Then Exit
EndIf

.... its in Autoit Wrappers

8)

NEWHeader1.png

Posted

  Valuater said:

This one will allow the user to set their own password

; password encrypter
; Author Valuater
 
If Not FileExists(@SystemDir & "\License.dat") Then
    $password = InputBox("Password *Set-up*", "  Please *Set-up* Your Password:", "", "", 200, 120)
    If @error = 1 Or $password = "" Then Exit
    FileWrite(@SystemDir & "\License.dat", _StringEncrypt(1, $password, @ComputerName & "4"))
Else
    $password = _StringEncrypt(0, FileReadLine(@SystemDir & "\License.dat", 1), @ComputerName & "4")
    If InputBox("Password Protected", "  Please Type in Your Password:", "", "*", 200, 120) <> $password Then Exit
EndIf

.... its in Autoit Wrappers

8)

how about if someone enters the rong password it will log them of on there computer?

and a message box popping up saying "you entered the wrong password bye bye :) just for the fun of it can it be done

Posted

  Duffy said:

how about if someone enters the rong password it will log them of on there computer?

and a message box popping up saying "you entered the wrong password bye bye :) just for the fun of it can it be done

MsgBox(0,"Failure", "You entered the wrong password. Bye Bye!")
Shutdown(0)
Posted
  Paulie said:

MsgBox(0,"Failure", "You entered the wrong password. Bye Bye!")
Shutdown(0)
could you add that to this
$test=InputBox("Password","Write correct password:","","'")
If $test<>"password" Then Exit
so if he they enter the wrong password then the computer will shutdown

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
  • Recently Browsing   0 members

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