Jump to content
Sign in to follow this  

[Solved] Login Script with MySql database

Recommended Posts


Hi everyone !

I try to make a login script by using a Mysql database.

I use because he looks easier to use than and the real autoit code.

So i do this :

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include "mysql.au3"
#include <SQLite.au3>
#include <SQLite.dll.au3>

Dim $wait

#Region ### START Koda GUI section ### Form= Identification
$ID_Form = GUICreate("Identification", 259, 123, 192, 124)
$NdC_Lbl = GUICtrlCreateLabel("Nom de compte ", 16, 16, 82, 17)
$PsWd_Lbl = GUICtrlCreateLabel("Mot de passe", 16, 48, 68, 17)
$NdC_Input = GUICtrlCreateInput("", 120, 16, 121, 21)
$PsWd_Input = GUICtrlCreateInput("", 120, 48, 121, 21)
$Login_Btn = GUICtrlCreateButton("Connexion a la messagerie", 16, 80, 225, 33)
#EndRegion ### END Koda GUI section ### Form= Identification

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Login_Btn
$NdC = GUICtrlRead ($NdC_Input)
$PsWd = GUICtrlRead ($PsWd_Input)
$UserName = "root"
$Password = ""
$Database = "oom_messagerie"
$MySQLServerName = ""
$Mysql_connexion = _MySQLConnect($UserName,$Password,$Database,$MySQLServerName,"{MySQL ODBC 3.51 Driver}",3306)

If @error Then
_Erreur_1 ()

$connexion_requette1 = "select ID from utilisateur where NdC ='"& $NdC &"' AND PsWd ='"& $PsWd &"'"
$req = _Query ($Mysql_connexion,$connexion_requette1)

If @error Then
_Erreur_2 ()
While 1
If $req <> 0 Then
MsgBox (0,"Victory","Sa marche bro !") ;work test msgbox
Sleep (1000)
$wait = $wait+1
If $wait = 5 Then
MsgBox (0,"Fail","Tjr pas dude :/"& @error) ;fail test msgbox


Func _Erreur_1 ()
MsgBox (61,"OUTCH !","Epic Fail ! erreur de connexion a la database ")

Func _Erreur_2 ()
MsgBox (61,"OUTCH !","Epic Fail ! erreur dans la requette de la table")

I think that my script can connect to the database but i cant get the value of query.

I'm in LocalHost ( Xampp ) with ODBC instaled, my database is call oom_messagerie and my table oom_connexion .

I work 2 days on it and i really hit my head on the keyboard right now ... I'm not very strong in Autoit and juste begin Mysql so i really need some help :)

Thanks everyone !

PS : I'm french ! sorry for the worst english you ever seen !!!

Edited by simkpa

Share this post

Link to post
Share on other sites


I have to be honest, I've never used the MySQL UDF's... Instead, I use the SQLite UDF's... A while back I posted a script which relies on a database. You can see it here:

With luck it might give you some ideas with MySQL or convert you to SQLite.... Or, give you something to do while you wait for someone with MySQL experience ;)

Share this post

Link to post
Share on other sites

Hello ! Thx for your help Colyn1337, a just found how to do it with Mysql Udf, this is the code :

With $query_var
While Not .EOF
$test &= .Fields ("column_name ").value & @CRLF

You can use the $test var has the seleted part of the Mysql database.

Thx everyone ! I hope this can help someone else :)

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.