Jump to content

Problem with function passwordVerify


Pantry

Recommended Posts

function loginAccount(login, password)
    local performLogin = exports.TR_mysql:query("SELECT UID, password, username, tutorial FROM `accounts` WHERE `login` = ? LIMIT 1", login)
    if performLogin and performLogin[1] then
        if passwordVerify(password, performLogin[1]["password"]) then
            if isPlayerLogged(performLogin[1]["UID"]) then triggerClientEvent(client, "loginResponseServer", resourceRoot, "Esta conta já está logada.", "error") return end

            if performLogin[1].usernane then
                setPlayerName(client, performLogin[1].username)
            end
            setElementData(client, "tempUID", performLogin[1].UID)
            exports.TR_mysql:query("UPDATE accounts SET isOnline = 1, lastOnline = NOW() WHERE `UID` = ? LIMIT 1", performLogin[1].UID)

            triggerClientEvent(client, "loginPlayer", resourceRoot, performLogin[1].username, performLogin[1].tutorial)

            exports.TR_mysql:query("UPDATE `accounts` SET `lastOnline` = NOW() WHERE UID = ? LIMIT 1;", performLogin[1].UID)
        else
            triggerClientEvent(client, "loginResponseServer", resourceRoot, "A senha inserida está incorreta.", "error")
        end
    else
        triggerClientEvent(client, "loginResponseServer", resourceRoot, "Esse usuário não existe.", "error")
    end
end
addEvent("loginAccount", true)
addEventHandler("loginAccount", resourceRoot, loginAccount)

ERROR IN COMMAND:
Bad argument @ 'passwordVerify' [Expected string at argument 2, got nill]

I am unable to use passwordVerify

Edited by Pantry
Link to comment

Hello Pantry,

I am not sure what happens if there are no UID, password, username or tutorial columns inside of your "accounts" table. Could you please check using a tool like Navicat Lite if there really are such columns? You could, instead of an external tool, use a "SELECT * FROM accounts" query and list the column names using table.pairs onto the game server, like this:

local results = exports.TR_mysql:query("SELECT * FROM accounts");

if (results) then
    for colname,value in pairs(results[1]) do
        print("COLUMN: " .. colname);
    end
end

Look into your server log for the column names.

Edited by The_GTA
Link to comment
13 minutes ago, The_GTA said:

Hello Pantry,

I am not sure what happens if there are no UID, password, username or tutorial columns inside of your "accounts" table. Could you please check using a tool like Navicat Lite if there really are such columns? You could, instead of an external tool, use a "SELECT * FROM accounts" query and list the column names using table.pairs onto the game server, like this:

local results = exports.TR_mysql:query("SELECT * FROM accounts");

if (results) then
    for colname,value in pairs(results[1]) do
        print("COLUMN: " .. colname);
    end
end

Look into your server log for the column names.

They columns exist: /
 

https://i.imgur.com/uIcmvWb.png
https://i.imgur.com/ozZ3azl.png

 

Edited by Pantry
Link to comment
8 minutes ago, Pantry said:

They columns exist: /

A different error scenario could be a faulty TR_mysql resource. I don't know how the resource works because it does not seem to be available in public. Are you able to share the code of the query function?

Link to comment
4 minutes ago, The_GTA said:

A different error scenario could be a faulty TR_mysql resource. I don't know how the resource works because it does not seem to be available in public. Are you able to share the code of the query function?

I sent the complete server-side code of the resource, and mysql to you in mp

Link to comment
4 minutes ago, Pantry said:

I sent the complete server-side code of the resource, and mysql to you in mp

Thank you. I read it completely and unfortunately there is no error inside of it. This looks very weird to me because I have not dealt with this SQL situation before. So please follow my next guidance for error detection.

Could you add the following debug line after your SQL query to find out what contents are being put-out?

function loginAccount(login, password)
    local performLogin = exports.TR_mysql:query("SELECT UID, password, username, tutorial FROM `accounts` WHERE `login` = ? LIMIT 1", login)
    if performLogin and performLogin[1] then
        outputDebugString("UID: " .. tostring(performLogin[1].UID) .. ", has_pw: " .. tostring(not (performLogin[1].password == nil)) .. ", username: " .. tostring(performLogin[1].username) .. ", tutorial: " .. tostring(performLogin[1].tutorial));
        ...

Do you get any output into your debug console? And if yes, does it tell you meaningful things?

Link to comment
1 minute ago, The_GTA said:

Obrigada. Eu li completamente e infelizmente não há nenhum erro dentro dele. Isso me parece muito estranho porque nunca lidei com essa situação SQL antes. Portanto, siga minha próxima orientação para detecção de erros.

Você poderia adicionar a seguinte linha de depuração após sua consulta SQL para descobrir quais conteúdos estão sendo disponibilizados?


    
                 
        

Você obtém alguma saída em seu console de depuração? E se sim, isso lhe diz coisas significativas?

Hey my friend, you are a genius, I downloaded another mysql and solved it..
Link to comment
9 minutes ago, GoodNight said:

I guess, you're using InsideMTA gamemode? Someone put a bugged package on the internet, it has backdoors. So check the whole code before you decide to use it. 

You are alleging him to make unauthorized use of a gamemode resource? Maybe he does, maybe not. I am not affiliated with this dude in any way and don't want to be involved in any thievery.

I have to say that multiple people have come forward with support requests about similar code. I would say that your leak hint is not unfounded. But leave me out of this mess.

Edited by The_GTA
  • Like 1
Link to comment
28 minutes ago, The_GTA said:

You are alleging him to make unauthorized use of a gamemode resource? Maybe he does, maybe not. I am not affiliated with this dude in any way and don't want to be involved in any thievery.

I have to say that multiple people have come forward with support requests about similar code. I would say that your leak hint is not unfounded. But leave me out of this mess.

Of course, I'm not saying anything about you, I respect your commitment to helping people. And about the code, I have quite a lot of evidence (Comparing the code straight from the server - my friend was working on some scripts, and it's just the same, but without bugs and backdoors)

  • Like 1
Link to comment
10 hours ago, GoodNight said:

Of course, I'm not saying anything about you, I respect your commitment to helping people. And about the code, I have quite a lot of evidence (Comparing the code straight from the server - my friend was working on some scripts, and it's just the same, but without bugs and backdoors)

I just find it detrimental that, instead of helping genuine users, the scripting support requests are abused by wanna-be copycats. Not only are they unable to script, they are illegitimately attracted by $$$ and success. In terms of diginity and respect, the copycats cannot surpass the good-faith newbie. I often find myself in doubt if this person is really just struggling or he is running a set-up. But I won't lose hope.

Edited by The_GTA
Link to comment
  • IIYAMA locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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