Sign in to follow this  
Followers 0
GraaF1337

Login form not working propperly.

5 posts in this topic

#1 ·  Posted (edited)

Okay so im trying to license my script, by doing a login check on my site.

And i had no clue how to do this until i found some old code by another user.

But his thread was closed as "auto logins" aren't allowed.

And this seem to work on some places but not on forums.

 

But as im not gonna use this as an "auto" login but as a "client" i guess it's okay?

This is the orginal thread i created, where i was asking about how to licese a script.

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <ComboConstants.au3>
#include <Misc.au3>
#include <WindowsConstants.au3>
#include <NomadMemory.au3>
#include <WinApi.au3>
#include <SecurityConstants.au3>
#include <Security.au3>
#include <WinAPIEx.au3>
#include <Console.au3>
#include <GDIPlus.au3>
#include <Crypt.au3>
#include <File.au3>
#include <IE.au3>
#include <InetConstants.au3>
#include <EditConstants.au3>
#RequireAdmin

$Url = 'MY WEBSITE GOES HERE'

$Form1 = GUICreate("Login Client Connect Test", 326, 258, 192, 124)
GUISetState(@SW_SHOW)




$usernamebox = GUICtrlCreateInput("Username", 85, 130, 200, 18)
$passwordbox = GUICtrlCreateInput("Pasword", 85, 155, 200, 18, $ES_PASSWORD)
$loginbutton = GUICtrlCreateButton("Login", 130, 180, 100, 20)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit


        Case $loginbutton
            $User = GUICtrlRead($usernamebox)
            $Pwd = GUICtrlRead($passwordbox)

$test = _IEAutoLogin($Url, $User, $Pwd)


    EndSwitch
WEnd



Func _IEAutoLogin($sUrl, $sUsername, $sPwd)
 ;funkey 09.09.09
 $oIE = _IECreate($sUrl)
 _IEErrorNotify(False)
 _IEErrorHandlerRegister()
 $oForms = _IEFormGetCollection($oIE)
 If @error Then
  Return SetError(1, _IEErrorHandlerDeRegister(), $oIE) ;'no forms --> no login'
 Else
  $Index = 0
  For $oForm In $oForms
   $oFormElements = _IEFormElementGetCollection($oForm)
   If IsObj($oFormElements) Then
    $IndexElement = 0
    For $oElement In $oFormElements
     If $oElement.Type = 'password' Then
      $oPwd = _IEFormElementGetObjByName($oForm, $oElement.Name)
      _IEFormElementSetValue($oPwd, $sPwd)
      For $i = $IndexElement - 1 To 0 Step -1
       $oUser = _IEFormElementGetCollection($oForm, $i)
       If $oUser.Type = 'text' Then
        _IEFormElementSetValue($oUser, $sUsername)
        ExitLoop
       EndIf
      Next
      If $oForm.action <> "0" And Not StringInStr($oForm.action, '.php') Then
       _IEFormSubmit($oForm, 0)
       _IELoadWait($oIE)
      Else  ;click
       For $i = $IndexElement + 1 To $IndexElement + 10
        $oButton = _IEFormElementGetCollection($oForm, $i)
        If $oButton.Type = 'submit' Then
         _IEAction($oButton, "click")
         ExitLoop
        EndIf
       Next
      EndIf
      Return SetExtended(_IEErrorHandlerDeRegister(), $oIE)
     EndIf
     $IndexElement += 1
    Next
   EndIf
   $Index += 1
  Next
 EndIf
 Return SetError(2, _IEErrorHandlerDeRegister(), $oIE)
EndFunc
Edited by GraaF1337

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

That code doesn't work with the last Autoit version, you need to convert practically the entire script.

There is another problem: the datas transmitted are clear text, but we are speaking about sensitive information like userpassword, so you have to encrypt and send them to the form in another way.

EDIT:

The security issue can be solved if you have an SSL certificate on your site and you connect via https instead of http

Edited by j0kky

Share this post


Link to post
Share on other sites

That code doesn't work with the last Autoit version, you need to convert practically the entire script.

There is another problem: the datas transmitted are clear text, but we are speaking about sensitive information like userpassword, so you have to encrypt and send them to the form in another way.

EDIT:

The security issue can be solved if you have an SSL certificate on your site and you connect via https instead of http

I do have an SSL certificate, so ill use that. :)

And about this not working propperly i know that, thats why im posting, as i dont really have an idea whats wrong ^^

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I know that all you guys do support for free and in your spare time and i appreciate it so much! :) But is there really nobody who able to help me? :o

Edited by GraaF1337

Share this post


Link to post
Share on other sites

You have to look at the script, note the used functions and search for them in the help file.

If you don't find them, it means they are no longer supported and they have been replaced with another ones (and you have to replace them with the correct ones).

For example:

_IEErrorHandlerRegister()

Another story is for $oElement.Type, this kind of element has been replaced by the function

_IEFormElementSetValue

Generally, look at IE UDF and read the example scripts in the help file, it is a valid support for your scope.

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