Sign in to follow this  
Followers 0
liten

Autoit Login script (No ODBC) Problem

4 posts in this topic

#1 ·  Posted (edited)

Hello i am having a problem with my code for the no ODBC Login , it always says succesful login EVEN if the account dosent exzist, or the PW is wrong,

Help me please,

Heres what i was trying to do, you login if your UN and PW exzist (same row of course,) and if the login is succesful it says so thenn., it checks another column in that same row to see if they have game time left, (ex. if you a4re out of game time ytou cant login)if you do have time left, it does a function

#include <array.au3>
#include <mysql.au3>
FileInstall("C:\Program Files\AutoIt3\Include\libmysql.dll", @HomeDrive & "\Windows\System\libmysql.dll")
_MySQL_InitLibrary(@HomeDrive & "\Windows\System\libmysql.dll")
If @error Then Exit MsgBox(0, '', "Error")
$MysqlConn = _MySQL_Init()

$connected = _MySQL_Real_Connect($MysqlConn, "localhost", "root", "ROOT", "forum")
If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn))

$yam = "Test"
$pass = "Test"
$TimeLeft = ""
$query1 = "SELECT " & $yam &" FROM Test WHERE Time='"  & _MySQL_Real_Escape_String($MysqlConn,$TimeLeft) & "'"
$query2 = "SELECT * FROM Test WHERE Username='"  & _MySQL_Real_Escape_String($MysqlConn,$yam) & "' AND Password='" & _MySQL_Real_Escape_String($MysqlConn,$pass) & "'"
If _MySQL_Real_Query($MysqlConn, $query2) = $MYSQL_ERROR Then
    MsgBox(0, 'Login Error',"Account not found , Exzact Error-" & _MySQL_Error($MysqlConn))
Else

;------------------------------------------------------


;------------------------------------------------------

$res = _MySQL_Store_Result($MysqlConn)
$users = _MySQL_Num_Rows($res)
MsgBox(0, '', "AccountFound")
If _MySQL_Real_Query($MysqlConn, $query1) = $MYSQL_ERROR Then
    MsgBox(0, 'Varification Error"You Are out of time, Please buy more"', _MySQL_Error($MysqlConn))
Else
    MsgBox(0,'',"AccountVerified, Enjoy")
EndIf

    
;~; Abfrage freigeben
_MySQL_Free_Result($res)
EndIf
;~; Verbindung beenden
_MySQL_Close($MysqlConn)
;~; MYSQL beenden
_MySQL_EndLibrary()

Help me fix this please

FIXED:

#include <array.au3>
#include "mysql.au3"

_MySQL_InitLibrary()
If @error Then Exit MsgBox(0, '', "")
$MysqlConn = _MySQL_Init()

$connected = _MySQL_Real_Connect($MysqlConn, "localhost", "root", "ROOT", "forum")
If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn))

$yam = "Test"
$pass = "Test"
$Time = "Test"

$query = "SELECT * FROM Test WHERE Username='"  & _MySQL_Real_Escape_String($MysqlConn,$yam) & "' AND password='" & _MySQL_Real_Escape_String($MysqlConn,$pass) & "' AND Time='" & _MySQL_Real_Escape_String($MysqlConn,$time) & "'"
MsgBox(0, '', $query)
If _MySQL_Real_Query($MysqlConn, $query) = $MYSQL_ERROR Then
    MsgBox(0, 'Error', _MySQL_Error($MysqlConn))
Else

;------------------------------------------------------


;------------------------------------------------------

$res = _MySQL_Store_Result($MysqlConn)
$users = _MySQL_Num_Rows($res)
if $users == 1 then;if the user is found 
MsgBox(0, '', "Account Found Login succesful.");what to do if the user is found 
;Unlock Tabs
Else
    MsgBox(0,'',"Login Failed EIther your UN and PW is wrong or you are out of time.");what to do if the UN and PW is not found
EndIf


;~; Abfrage freigeben
_MySQL_Free_Result($res)
EndIf
;~; Verbindung beenden
_MySQL_Close($MysqlConn)
;~; MYSQL beenden
_MySQL_EndLibrary()
Edited by liten

My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites



bump


My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

Share this post


Link to post
Share on other sites

I can not follow the script exactly, but you can take a look at this. It can probably do what you are looking for in a much safer and secure manner.


[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites

FIXED


My UDF:Freeze.au3-Freeze values like CE, ML, ETC[i][/i][u][/u]

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