Jump to content

[HELP]CONNECT LOGIN PANEL WITH MYSQL


Ekko

Recommended Posts

Server-side





function onServerRegister ( player, email, password, code )
    local accountAdded = addAccount( email, password )
    if ( accountAdded) then
        logIn( player, accountAdded, password )
        triggerClientEvent( player, "onCommand", player, "reg_success" )

        if ( code and type(code) == "number" and #code == 4 ) then
            setAccountData( accountAdded, "Secret Code", code )
        else
            setAccountData( accountAdded, "Secret Code", "none" )
        end
        local time = getRealTime()
        local hours = time.hour
        local minutes = time.minute
        local second = time.second
        local year = time.year+1900
        local month = time.month+1
        local day = time.monthday
        local ymdhms =  ( year.."-"..month.."-"..day.." "..hours..":"..minutes..":"..second )
        setAccountData( accountAdded, "Register Date", ymdhms )
        local userid = #getAccounts()
        setAccountData( accountAdded, "UID", userid + 1 )

        outputChatBox( "ท่านลงทะเบียน สำเร็จแล้ว / ข้อมูลของท่านคือ", player, 255, 255, 255, true)
        outputChatBox( "#FF0000Email: #A6A6A6" .. email, player, 255, 255, 255, true)
        outputChatBox( "#FF0000Password: #A6A6A6" .. email, player, 255, 255, 255, true)
    else
        triggerClientEvent( player, "onCommand", player, "reg_error" )
    end
end
addEvent( "onServerRegister", true )
addEventHandler( "onServerRegister", root, onServerRegister )

function onServerLogin ( player, email, password, checked )
    local account = getAccount( email, password )
    if ( account) then
        logIn( player, account, password )
        triggerClientEvent( player, "onCommand", player, "login_success", checked, email, password )

        setElementData( player, "Secret Code", getAccountData( account, "Secret Code" ) )
        setElementData( player, "Register Date", getAccountData( account, "Register Date" ) )
        setElementData( player, "UID", getAccountData( account, "UID" ) )

        outputChatBox( "ยินดีต้อนรับ เข้าสู่เซิฟร์เวอร์", player, 255, 255, 255, true)
    else
        triggerClientEvent( player, "onCommand", player, "login_error" )
    end
end
addEvent( "onServerLogin", true )
addEventHandler( "onServerLogin", root, onServerLogin )


Hello this is a login panel server side  help me pls to connect it with MYSQL 

Edited by Ekko
Link to comment
8 minutes ago, Dimos7 said:

show us what you did

deleted all what i did it wont work so i decided to do some thing stupid i'm gonna use 2 login panels in my server , the first one for the design i'm trying now to add a Gui button to stop it after the player log in with the secend login panel :D 

Edited by Ekko
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...