i do it so:
Ape.registerHookCmd("connect", function(params, cmd) {
sql_query(cmd, params, function(result) {
if (result == 1) Ape.addUser(cmd.user);
else cmd.user.setProperty('name', result);
});
cmd.user.setProperty('uid', params.uid);
return 1;
});
function sql_query(cmd, params,callback){
sql.query('SELECT * FROM user WHERE uid="'+params.uid+'" LIMIT 1;',
function(res, errorNo) {
if (errorNo) {
username = "mysql error";
} else {
username = (res[0].name.length>=3 ? res[0].name :
(res[0].id>0?"USER "+res[0].id:"Guest") );
cmd.user.setProperty('name', username);
callback(1);
}
var ret = {};
try { ret = username; } catch(e){};
callback(ret);
//Ape.addUser(cmd.user);
});
}
but it don't work correctly, can you help me more?
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/