Jump to content

What's wrong ?


papam77

Recommended Posts

server.lua

local serverContainer = {} 
serverContainer.Settings = {} 
-- settings 
serverContainer.Settings.user = 'zahrej' 
serverContainer.Settings.pass = ' Can't tell you it :* ' 
serverContainer.Settings.host = 'mysql.mmhost.eu:3306' 
serverContainer.Settings.name = 'zahrej' 
  
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 mtamembers 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) 

databaseczech.png

Can't press login button why ? :o

Link to comment

Try:

local serverContainer = {} 
serverContainer.Settings = {} 
-- settings 
serverContainer.Settings.user = 'zahrej' 
serverContainer.Settings.pass = " Can't tell you it :* " 
serverContainer.Settings.host = 'mysql.mmhost.eu:3306' 
serverContainer.Settings.name = 'zahrej' 
  
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 mtamembers 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) 
  

Edit: Lol. Thanks miki.

Edited by Guest
Link to comment
    local serverContainer = {} 
    serverContainer.Settings = {} 
    -- settings 
    serverContainer.Settings.user = 'zahrej' 
    serverContainer.Settings.pass = " Can't tell you it :* " 
    serverContainer.Settings.host = 'mysql.mmhost.eu:3306' 
    serverContainer.Settings.name = 'zahrej' 
      
    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 mtamembers 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
    local serverContainer = {} 
    serverContainer.Settings = {} 
    -- settings 
    serverContainer.Settings.user = 'zahrej' 
    serverContainer.Settings.pass = " Can't tell you it :* " 
    serverContainer.Settings.host = 'mysql.mmhost.eu:3306' 
    serverContainer.Settings.name = 'zahrej' 
      
    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 mtamembers 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) 
  

So still don't work i am clicking to Log In and nothing happend :S

Link to comment

client.lua

local clientContainer = {} 
  
clientContainer.createLogin = function() 
    clientContainer.GUI = {} 
    local resX, resY = guiGetScreenSize(); 
    clientContainer.GUI.root = guiCreateWindow(resX/2-300/2, resY/2-117.5/2, 300, 117.5, 'authentication', false) 
    -- USERNAME 
    clientContainer.GUI.UserLab = guiCreateLabel(10,25,75,25,'Username:',false,clientContainer.GUI.root) 
    clientContainer.GUI.UserEdt = guiCreateEdit(70,22.5,225,25,'', false,clientContainer.GUI.root) 
    -- PASSWORD 
    clientContainer.GUI.PassLab = guiCreateLabel(10,55,75,25,'Password:',false,clientContainer.GUI.root) 
    clientContainer.GUI.PassEdt = guiCreateEdit(70,52.5,225,25,'', false,clientContainer.GUI.root) 
    guiEditSetMasked(clientContainer.GUI.PassEdt, true) 
    -- BUTTONS 
    clientContainer.GUI.Check = guiCreateCheckBox(10,82.5,75,25,'save Data!',false,false,clientContainer.GUI.root) 
    clientContainer.GUI.LogButt = guiCreateButton(216,82.5,75,25,'Log In',false,clientContainer.GUI.root) 
    -- HANDLER 
    addEventHandler('onClientGUIClick', clientContainer.GUI.LogButt, function() 
        local user = guiGetText(clientContainer.GUI.UserEdt); 
        local pass = guiGetText(clientContainer.GUI.PassEdt); 
        if pass and pass ~= '' and user and user ~= '' then 
            triggerServerEvent('onClientLogins', localPlayer, user, pass) 
        end 
    end, false) 
     
    -- XML 
    if fileExists('acc.xml') then 
        local accRoot = xmlLoadFile('acc.xml') 
        if accRoot then 
            for index, child in next, xmlNodeGetChildren(accRoot) do 
                if xmlNodeGetAttribute(child,'Save') == 'true' then  
                    guiSetText(clientContainer.GUI.UserEdt,xmlNodeGetAttribute(child,'Username')) 
                    guiSetText(clientContainer.GUI.PassEdt,xmlNodeGetAttribute(child,'Password')) 
                    guiCheckBoxSetSelected(clientContainer.GUI.Check,true) 
                end 
            end 
            xmlUnloadFile(accRoot) 
        end 
    else 
        local accRoot = xmlCreateFile('acc.xml','authentication') 
        if accRoot then 
            local settings = xmlCreateChild(accRoot,'Settings') 
            -- settings 
            xmlNodeSetAttribute(settings,'Username','') 
            xmlNodeSetAttribute(settings,'Password','') 
            xmlNodeSetAttribute(settings,'Save','false') 
            xmlSaveFile(accRoot) 
            xmlUnloadFile(accRoot) 
        end 
    end 
     
    showCursor(true) 
end 
  
addEventHandler('onClientResourceStart', resourceRoot, clientContainer.createLogin) 
  
clientContainer.onClientSuccessfullyLogin = function() 
    -- XML SAVE 
    if ( guiCheckBoxGetSelected(clientContainer.GUI.Check) == true ) then 
        local accRoot = xmlLoadFile('acc.xml') 
        if accRoot then 
            for index, child in next, xmlNodeGetChildren(accRoot) do 
                xmlNodeSetAttribute(child,'Save','true') 
                xmlNodeSetAttribute(child,'Username',guiGetText(clientContainer.GUI.UserEdt)) 
                xmlNodeSetAttribute(child,'Password',guiGetText(clientContainer.GUI.PassEdt)) 
            end 
            xmlSaveFile(accRoot) 
            xmlUnloadFile(accRoot) 
        end 
    end 
    destroyElement(clientContainer.GUI.root) 
    showCursor(false) 
end 
  
addEvent('onClientSuccessfullyLogin', true) 
addEventHandler('onClientSuccessfullyLogin', root, clientContainer.onClientSuccessfullyLogin) 

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...