TGC Codebase Backup



NO DOT NET REQUIRED by Mugen Wizardry

18th Aug 2011 13:15
Summary

This is the 1st library ever for EASILY using the MySQL ODBC drivers, to check user authentications. GREAT use for MMORPGs! :)



Description

Hello one, hello all! I have been studying using SQL for a while on these forums with DarkBasic Pro. Now, I have FINALLY made that happen, thanks to someone on this forum, known as "n0isy". All credit goes to him for the making of this SQL plugin and DECLS file.

To download the NO .NET needed SQL plugin, go here:

[href]http://forum.thegamecreators.com/?m=forum_view&t=184486&b=18[/href]

You will ALSO need to download the simple message box plugin (Credit: Twisted Steel Software)

You can download THAT at: [href]http://forum.thegamecreators.com/?m=forum_view&t=127624&b=1[/href]

You will ALSO need BBB GUI (when I upload the NEW library file I'm making). (You do NOT need it right now. :) I will add the BBB GUI link with a credit to Brendy Boy in a bit.

If you do NOT have the ODBC DLL file, needed to connect using MySQL, you can download it from my forum post at: ! :) I have already scanned it for viruses, there are none at all. If you want to scan it more, feel free! :)

You will then need to put it inside of a folder in your Program Files OR Program Files (X86) folder, depending on your version of Windows.

In my case, it's C:\Program Files (x86)\MySQL\Connector ODBC 3.51\

Because I have Windows 7 - 64 Bit.

In the case of Vista and under, use C:\Program Files\MySQL\Connector ODBC 3.51

If you do NOT have the folder in your program files called MySQL (Yes, spell it the EXACT way I did. Grammar and all)., Then make that folder there. And then INSIDE of the MySQL folder, create a folder named "Connector ODBC 3.51". (Again, spell it the EXACT same way I did). THEN you need to put myodbc3.dll inside the Connector ODBC 3.51 folder AFTER extracting it.

I hope this helps everyone!

Have a nice day! :)

~MW~



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Rem Project: NO .NET SQL
Rem Created: Thursday, August 18, 2011
Rem Created By: Mugen Wizardry

Rem Copyright 2011 - 2012

Rem You MAY not sell this code.
Rem If you do, you are subject to the copyright laws not only myself, but N0isy abides by as well

Rem You MUST keep this header intact

Rem ***** Main Source File *****

`CONNECTION STRINGS
`===================================================
global conn
global connstring$
`===================================================

`CONNECTION LOGIN STUFF
`===================================================
global driver$
global host$
global mydb$
global user$
global pass$
global option
`===================================================

`MYSQL QUERY
`===================================================
global query$
global myquery
`===================================================

`BBB GUI LOGIN
`===================================================
global username$
global password$
`===================================================

`DATABASE LOGIN
`===================================================
driver$ = "{MySQL ODBC 3.51 Driver}"
host$ = "localhost"
mydb$ = "imagepos_membersonly"
user$ = "root"
pass$ = "Gen0sis"
option = 3

username$ = "Jldrum19"
password$ = "montour"

connstring$ = "DRIVER="+driver$+";Server="+host$+";Database="+mydb$+";User="+user$+"; Password="+pass$+";Socket=MySQL;"+"Option="+str$(option)+";"

conn=ODBC CONNECT(1, connstring$)

if conn = -1 then errormsg=TSS_message_box("ERROR!",ODBC ERROR$(1),TSS_MB_OK()+TSS_MB_ICONSTOP()) : end

if conn = 0

msg=TSS_message_box("CONGRATS!","You have been successfully connected to the "+mydb$+" database!",TSS_MB_OK()+TSS_MB_ICONEXCLAMATION())
    
query$ = "SELECT * FROM `users` WHERE `username` = '"+username$+"';"

myquery=ODBC EXECSQL(1, query$)

if myquery = -1

errormsg = TSS_message_box("ERROR!", ODBC ERROR$(1), TSS_MB_OK()+TSS_MB_ICONSTOP())

else

WHILE ODBC FETCHROW(1) = 0
    username$ = ODBC GETVALUE$(1,3) // String
    msg=TSS_message_box("CONGRATS!",username$,TSS_MB_OK()+TSS_MB_ICONEXCLAMATION())
ENDWHILE

`Check that the user is authenticated here
`===================================================
if username$ = "Jldrum19" and password$ = "montour"

    msg=TSS_message_box("CONGRATS 2!","Welcome, "+username$+"!",TSS_MB_OK()+TSS_MB_ICONEXCLAMATION())

endif
`===================================================

endif

endif
`===================================================

`MAIN LOOP
`===================================================
do
sync
loop
`===================================================