Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2012-02-10, 14:20


Jacob

Głupiomądry






Wiek: 28
Na forum: 5502 dni
Posty: 967
Nick w MP: Jacob

Piwa: 786

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

Kod:

function getValuesMySQL (login, pass)
local getQuery = mysql_query(handler, "SELECT login, haslo FROM rl_konta WHERE login='..login..' AND haslo='..string.lower(md5(pass))..'")
if (mysql_num_rows(getQuery) == 0) then
triggerClientEvent("sIfErrorSetText", getRootElement())
else
triggerClientEvent("sCloseOpenWindows", getRootElement())
end
mysql_free_result(getQuery)
end
addEvent("cGetValuesMySQL", true)
addEventHandler("cGetValuesMySQL", getRootElement(), getValuesMySQL)

Witam, mam taki kod i if si? nie spe?nia, czyli pokazuje mi funkcje z eventu sIfErrorSetText. W PHP zrobi?em w taki sam spos?b i dzia?a, a tutaj nie. Zmienne login i haslo pokazuj? warto?ci jakie maj? pokazywa?. Oczywi?cie po??czenie jest.
Zrzut z bazy danych wygl?da tak:

Z g?ry dzi?ki za pomoc.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-02-10, 14:27


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

masz tu login serwer :
Kod:

function onLogin ( player, user, pass )
local account = getAccount ( user, pass )
if ( account ~= false ) then
if (logIn ( player, account, pass ) == true) then
triggerClientEvent ( "hideLoginWindow", getRootElement())
else
outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong.
end
else
outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong.
end
end

addEvent( "onLogin", true )
addEventHandler( "onLogin", getRootElement(), onLogin )

function onRegister ( player, user, pass )
local account = getAccount ( user, pass )
if ( account ~= false ) then
if (logIn ( player, account, pass ) == true) then
triggerClientEvent ( "hideLoginWindow", getRootElement())
else
outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong.
end
else
account = addAccount ( user, pass )
if (logIn ( player, account, pass ) == true) then
triggerClientEvent ( "hideLoginWindow", getRootElement())
else
outputChatBox ( "Register/Login error!", player, 255, 255, 0 ) -- Output they got the details wrong.
end
end
end

addEvent( "onRegister", true )
addEventHandler( "onRegister", getRootElement(), onRegister )


Masz podzielone na Login i Register rak jak na g?rze
To z http://community.mtasa.com

Postaw piwo autorowi tego posta
 

 
Wysłany: 2012-02-10, 14:31


Jacob

Głupiomądry






Wiek: 28
Na forum: 5502 dni
Posty: 967
Nick w MP: Jacob

Piwa: 786

Respekt: 212,3
Respekt: 212,3Respekt: 212,3

luki123luki123, MySQL cz?eniu -.- Nie zwyk?a rejestracja i logowanie wbudowane w serwer. Dobra poradzi?em sobie. Mo?na close ;P

Postaw piwo autorowi tego posta
 

 
Tagi: mysql :: logowanie
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » MySQL Logowanie Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku