I'm trying to get a serverside extension built that will take a users login and password and check them against a MySQL database. I took the elements from dbExtension.as and through them into loginExample.as and all goes well! Except... When I go to check input password against database password, it says they don't match. I've been tracing the varibables, and everything looks correct to me. Here's some code snippets:
Code: Select all
if (evt.name == "loginRequest")
{
var error = ""
var nick = evt["nick"]
var pass = evt["pass"]
var chan = evt["chan"]
// create a SQL statement
var sql = "SELECT * FROM userid WHERE usr='" + nick + "'"
trace(sql)
Code: Select all
if (queryRes != null)
{
// Get a record
var tempRow = queryRes.get(0)
// From the record object we can get each field value
item.id = tempRow.getItem("id")
item.usr = tempRow.getItem("usr")
dbPass = tempRow.getItem("pwd")
item.pwd = tempRow.getItem("pwd")
item.email = tempRow.getItem("email")
item.power = tempRow.getItem("power")
//trace("ID:" + item.id + " Username: " + item.usr + " Password: " + dbPass + ":" + item.pwd + ":" + pass + " Email: " + item.email + " Power: " + item.power)
response.db.push( item )
}
else
error = "Authentication failed - User not found"
And this is where it dies:
Code: Select all
trace("ID:" + item.id + " Username: " + item.usr + " Password: " + item.pwd + ":" + pass + " Email: " + item.email + " Power: " + item.power)
if (pass != dbPass)
{
error = "Authentication failed - Wrong Password"
}
[dbVIP.as]: dbVIP extension loaded and running.
[dbVIP.as]: Event received: loginRequest
[dbVIP.as]: SELECT * FROM userid WHERE usr='gg20k'
[dbVIP.as]: ID:2 Username: gg20k Password: goodguy:goodguy Email: none@none.com Power: 1
Any thoughts?