Sign in to follow this  
Followers 0
h3adsh0ts

MySQL UDF login DB

2 posts in this topic

#1 ·  Posted (edited)

I have been trying for hours to find a way to compare login form through autoit to my MySQL user DB. The structure is as follows: UID = {User ID number}, username = {username}, password = md5{password}. I am placing this at the top of a few scripts I am making so that only users that are in this DB can use it. The UDF that I am using is I can explain further if necessary. Thanks for any help with this.

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
#include <String.au3>
#include <MySQL.au3>
#include <SQLite.au3>
LoginCheck()
Func LoginCheck()
Local $Username
Local $Password
Local $paid
Local $sql = _MySQLConnect('myuser','mypass','db_name','hostname')
Local $Username = _Query($sql,"SELECT * FROM mytable WHERE users = 'username'")
Local $Password = _Query($sql,"SELECT * FROM mytable WHERE users = 'password'")
Local $Paid = _Query($sql,"SELECT * FROM mytable WHERE users = 'paid'")
_MySQLEnd($sql)
If GUICtrlRead($User) = $Username and GUICtrlRead($Pass) = $Password and $paid = "1" Then
        $LoginSuccess = 1
    Else
        $LoginSuccess = 0
    EndIf
If $LoginSuccess = 1 Then
    GUIDelete()
    Control()
Else
    Dim $iMsgBoxAnswer
    $iMsgBoxAnswer = MsgBox(1,"Login Error!","Wrong Login Information!")
    Select
        Case $iMsgBoxAnswer = 2 ;Cancel
            Exit
        Case $iMsgBoxAnswer = 1 ;OK
            Login()
    EndSelect
EndIf
EndFunc

It probably looks noobish but idk how else to pull this off ><

Edited by h3adsh0ts

Share this post


Link to post
Share on other sites



Or would it be easier to write a php login script and let autoit use that? If that is even possible. I do not know how to do it if it is...

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