NO DOT NET REQUIRED by Mugen Wizardry18th 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. 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 `=================================================== |