Greenhound Posted April 10, 2013 Share Posted April 10, 2013 db = dbConnect( "mysql", "dbname=greenhound; host=127.0.0.1; port=3306", "root", "123", "share=0" ) It ignores the port key given, and connects on port 10061, which of course fails. Why? Link to comment
xXMADEXx Posted April 10, 2013 Share Posted April 10, 2013 Use this: function connect() db = dbConnect( "mysql", "dbname=greenhound; host=127.0.0.1", "root", "123", "autoreconnect=1" ) end addEventHandler("onResourceStart",root,connect) and you can read this to get the arguments. Link to comment
Greenhound Posted April 10, 2013 Author Share Posted April 10, 2013 I was reading that. I have the key port=3306 but it ignores it and connects on 10061 Link to comment
Greenhound Posted April 10, 2013 Author Share Posted April 10, 2013 Somebody answer... Link to comment
K4stic Posted April 10, 2013 Share Posted April 10, 2013 ignore it and use xXMADEXx code or my the username,password and IP must be same with your mySQL local function connect( ) connection = dbConnect( "mysql", "host IP", "username", "password", "share=1" ) if connection then outputConsole ( "Server is now connected with the MySQL database!", 1 ) return true else outputConsole ( "Connection with the MySQL database failed!", 1 ) return false end end addEventHandler ( "onResourceStart", resourceRoot, connect ) Link to comment
papam77 Posted April 10, 2013 Share Posted April 10, 2013 Or try use some functions of "Authifications" local serverContainer = {} serverContainer.Settings = {} -- settings serverContainer.Settings.user = 'ficker' serverContainer.Settings.pass = 'larsistcool123' serverContainer.Settings.host = '5.104.106.162' serverContainer.Settings.name = 'lars' -- only for example ;p -- [url=http://lars.projectx-gaming.net/]http://lars.projectx-gaming.net/[/url] serverContainer.startResource = function() local connection = dbConnect('mysql', 'dbname='..serverContainer.Settings.name..';host='..serverContainer.Settings.host, serverContainer.Settings.user, serverContainer.Settings.pass) if connection then outputDebugString('[MYBB-CONNECTER]: Could connect to the mysql server') serverContainer.connection = connection; else outputDebugString('[MYBB-CONNECTER]: Couldn\'t connect to the mysql server') end end addEventHandler('onResourceStart', resourceRoot, serverContainer.startResource) serverContainer.loginClient = function(user, pass) local qh = dbQuery(serverContainer.connection,'SELECT * FROM mybb_users WHERE username = ?',user) local result, row, errmsg = dbPoll ( qh, 5000 ) if row > 0 then for id, result in ipairs(result) do local salt = result['salt'] local username = result['username'] local password = result['password'] if salt and username and password then local newPass = md5(md5(salt):lower()..md5(pass):lower()):lower() if newPass == password then triggerClientEvent(source,'onClientSuccessfullyLogin',source) outputChatBox('#ff6666[sERVER]#ffffff You have successfully login.', source,1,1,1,true) else outputChatBox('#ff6666[sERVER]#ffffff This account doesn\'t exists or the password is wrong.', source,1,1,1,true) end end end end end addEvent('onClientLogins', true) addEventHandler('onClientLogins', root, serverContainer.loginClient) Link to comment
xXMADEXx Posted April 11, 2013 Share Posted April 11, 2013 These are the arguments: element dbConnect ( string databaseType, string host [, string username = "", string password = "", string options = "" ] ) therefore, i belive my code would work just fine. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now