Jump to content

MySQL UDF login DB


Recommended Posts

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
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...