Greetings People!
I have a little problem with my Login Panel, because if i click on the Register button then nothing happens. I just tested my MySQL connection too , but its shows that the Connection is good and nothing comes out in the Debugscript either.
If anyone can help me with this then Thank you!
--Here is the Code for the Register function Server Side
function registerReq(player, username, password, email)
local password = md5(password)
local regQuery = dbPoll(dbQuery(connection, "SELECT * FROM accounts"),-1)
if regQuery then
for _, rows in ipairs(regQuery) do
if rows["username"] == username then
exports.vmInfoBox:addNotification(player,"Ezzel a felhasználóval már regisztráltak!", "error")
return
end
if rows["serial"] == getPlayerSerial(source) then
exports.vmInfoBox:addNotification(player,"Az adott Serial már regisztrálva van!", "error")
return
end
insertinfo = dbExec(connection, "INSERT INTO accounts SET username = ?, password = ?, ip = ?, serial = ?, email = ?, banned='0', online='0', regdate=NOW()", username, password, getPlayerIP(source), getPlayerSerial(source), email, banned, online, regdate)
if insertinfo then
exports.vmInfoBox:addNotification(player,"Sikeres regisztráció!", "success")
else
exports.vmInfoBox:addNotification(player,"Valami hiba történt, keress fel egy fejlesztöt!", "error")
end
end
end
end
addEvent("registerReq", true)
addEventHandler("registerReq", getRootElement(), registerReq)
-- This is the code for Client Side
function regregisterClick(button, state)
if button == "left" and state == "down" then
if source == regregbutton then
if string.len(DGS:dgsGetText(reguseredit)) < 5 then
exports.vmInfoBox:addNotification("A felhasználónév minimum 5 karakterböl kell állnia!", "error")
return
end
if string.len(DGS:dgsGetText(regpasswedit)) < 6 then
exports.vmInfoBox:addNotification("A jelszó minimum 6 karakterböl kell állnia!", "error")
return
end
if DGS:dgsGetText(regpasswedit) ~= DGS:dgsGetText(regpasswedit2) then
exports.vmInfoBox:addNotification("A két megadott jelszó nem egyezik!", "error")
return
end
if string.len(DGS:dgsGetText(regmailedit)) < 7 then
exports.vmInfoBox:addNotification("Az email cím minimum 7 karakterböl kell állnia!", "error")
return
end
if not string.find(DGS:dgsGetText(regmailedit), "@") and string.find(DGS:dgsGetText(regmailedit), ".") then
exports.vmInfoBox:addNotification("Kérlek adj meg egy érvényes email címet!", "error")
return
end
if DGS:dgsGetText(reguseredit) == "" and DGS:dgsGetText(regpasswedit) == "" and DGS:dgsGetText(regpasswedit2) == "" and DGS:dgsGetText(regmailedit) == "" then
exports.vmInfoBox:addNotification("Ne hagyd üresen a mezöket!", "error")
end
triggerServerEvent("registerReq", localPlayer, localPlayer, DGS:dgsGetText(reguseredit),DGS:dgsGetText(regpasswedit),DGS:dgsGetText(regpasswedit2),DGS:dgsGetText(regmailedit))
end
end
end
addEventHandler("onDgsMouseClick", getRootElement(), regregisterClick)