Jump to content

[help] MySQL


Recommended Posts

  
local hostname = "127.0.0.1" 
local database = "air_forum_server_db" 
local username = "root" 
local password = "********" 
  
local mysql = dbConnect("mysql", "dbname="..database..";host="..hostname, username, password) 
if mysql then 
    outputDebugString("MySQL has been successfuly connected!",3, 255, 255, 255, true) 
end 
local query = dbQuery(mysql,"SELECT * FROM `air_forum_server_db_tablemembers` WHERE 1") 
local poll = dbPoll(query,-1) 
function log(source,command,username,password) 
for k,v in ipairs(poll) do 
if username == (v.member_name) and (hash("sha1",username..password) == v.passwd) then 
outputChatBox("You Sucessfully logined in ",source,255,255,255,true) 
else 
outputChatBox("Wrong username/password",source,255,255,255,true) 
end 
end 
end 
addCommandHandler("log",log) 
  

um im trying to connect my smf forum and my mta server so its already done but when i try /log it outputs the number of tries of logins like

You Sucessfully logined in then

Wrong username/password 7 times cuz i have 8 accounts and only 1 matches so is there a way to fix this

Link to comment
      
    local hostname = "127.0.0.1" 
    local database = "air_forum_server_db" 
    local username = "root" 
    local password = "********" 
      
    local mysql = dbConnect("mysql", "dbname="..database..";host="..hostname, username, password) 
    if mysql then 
        outputDebugString("MySQL has been successfuly connected!",3, 255, 255, 255, true) 
    end 
    local query = dbQuery(mysql,"SELECT * FROM `air_forum_server_db_tablemembers` WHERE 1") 
    local poll = dbPoll(query,-1) 
    function log(source,command,username,password) 
    for k,v in ipairs(poll) do 
    if username == (v.member_name) and (hash("sha1",username..password) == v.passwd) then 
    outputChatBox("You Sucessfully logined in ",source,255,255,255,true) 
   --else 
    --outputChatBox("Wrong username/password",source,255,255,255,true) 
    end 
    end 
    end 
    addCommandHandler("log",log) 
      

And, make sure the passwords and what not are all right, what this does here is just disable the output for wrong user / pass.

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...