this is the SFS log
this is the codeupaepZone.as]: loginRequest <------ the event is fired
[upaepZone.as]: exec dbo.loginSmartfox 'arenas','arenas', 8 <---- I call the stored procedure
[upaepZone.as]: true <------ I'm tracing if the query results object is null
Error in extension [ upaepZone.as ]: TypeError: Cannot call method "get" of null (upaepZone.as#1528) Internal: 45 -- Line number: 44 in file: upaepZone.as <---- this is the error
Code: Select all
var error = ""
trace(evt.name);
if (evt.name == "loginRequest"){
var nick = evt["nick"]
var pass = evt["pass"]
var chan = evt["chan"]
var obj = _server.loginUser(nick, pass, chan) //temporally log the user to get an userId from the smartfox
var response = new Object()
response._typeMessage = "sys"
if (obj.success){
var u = _server.instance.getUserByChannel(chan)
var sqlquery = "exec dbo.loginSmartfox '" + nick + "','"+ pass +"', " + u.getUserId()
trace(sqlquery)
var queryRes = dbase.executeQuery(sqlquery)
trace(queryRes == null)
var tempRow = queryRes.get(0) // the SP is always returning data even if the user is wrong but the result of the query is always null, Why???
if (tempRow.getItem("Type") == "LoginSuccess"){
response._cmd = "logOK"
response.n = nick
response.id = u.getUserId()
response.mod = 0
}else{
//_server.kickUser(u, 15, "invalid username or password") //this is not working
response._cmd = "logKO"
response.err = "Invalid username or password"
}
}else{
response._cmd = "logKO"
response.err = obj.error
}
_server.sendResponse(response, -1, null, chan)
}Thank you in advance for your help.