Jump to content
Sign in to follow this  
telmob

SOLVED! All messed up, need simple help.

Recommended Posts

telmob

I have a script with more than 5000 thousand lines of code (yes, i'm sure i could slim it down, but i'm a n00bish)

I've got more than one GUI and lots of functions, and everything is working so far, but...

Now i'm trying to put a password script in the beginning of that huge code. If the password is correct, it should go to the GUI and show it.

How can i point to the beginning of the GUI if i have tons of functions and other GUIs in it? Is this possible, or do i need a specific function for the GUIs?

I know i can't have functions inside functions...

Edited by telmob

Share this post


Link to post
Share on other sites
Mechaflash

you should probably post a code snippet to the areas you want to adjust/add to. Makes it easier for someone to help.

also... how the hell did you write 5k lines of code and not know what you're doing :oops:

  • Like 1

Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites
telmob

LOL!

Ok, let's try to write some example code...

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $ButtonCancel
Exit
Case $ButtonOk
_Decrypt()
$Hash=IniRead($HashFile, GUICtrlRead($UsernameCheck), "Hash", "")
$HashTrimmed="0x"&StringTrimLeft(StringTrimRight($Hash,3),1)
$UserExists=IniReadSection($HashFile, GUICtrlRead($UsernameCheck))
If $UsernameCheck<>"" And $UserExists<>"" And _Crypt_HashData(GUICtrlRead($PasswordCheck),$CALG_MD5)=$HashTrimmed Then
Global $FirstUserNameFind = StringInStr(IniRead(@ScriptDir & "\data\config.ini", GUICtrlRead($UsernameCheck), "Nome", ""), " ")
Global $FirstUserNameResult = StringLeft(IniRead(@ScriptDir & "\data\config.ini", GUICtrlRead($UsernameCheck), "Nome", ""), $FirstUserNameFind)
Global $FullUserNameFind = IniRead(@ScriptDir & "\data\config.ini", GUICtrlRead($UsernameCheck), "Nome", "")
Global $UserQualif=GUICtrlRead($UsernameCheck)
_Crypt()
GUICtrlSetState($AcessDeniedLabel, $GUI_HIDE)
GUICtrlSetState($AcessGrantedLabel, $GUI_SHOW)
Sleep(1000)
GUIDelete()
-------------------------------------------------------How do i point to the GUI here if i can't use more funcs?
ElseIf $UserExists="" OR _Crypt_HashData(GUICtrlRead($PasswordCheck),$CALG_MD5)<>$Hash Then
GUICtrlSetState($AcessDeniedLabel, $GUI_SHOW)
Sleep(1000)
GUICtrlSetState($AcessDeniedLabel, $GUI_HIDE)
_Crypt()
EndIf
EndSwitch
WEnd


$GUI
bla
bla
bla
Lots of funcs here...

Here some GUI elements change.

Share this post


Link to post
Share on other sites
JLogan3o13

Hi, Telmob. So put in a Function like this:

Func _mypw()

$pw = "mypw"
$input = InputBox("My Script Name", "Please enter a password", "", "*")
If $pw <> $input Then
Exit
EndIf

EndFunc

And then call the function on your first line:

_mypw()
Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
kylomas

telmob,

If authentication is truly what you need see the "InputBox" function.

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
telmob

Thanks Kylomas, i'm using inputboxes already. It just would make the example code huge to post everything here.

JLogan3013, You just gave me an idea :oops:

You can mark this thread as solved!

Thanks again.

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  

×