That worked. Thanks. Final code below

Ape.registerHookCmd("connect", function(params, cmd) {
    Ape.log('custom log');
    if ( ! params || ! params.token) return ["001", "INVALID PARAMS"];
 checkLogin(params, cmd);
 Ape.log('connect hook end');
 return -1;
});
 
function checkLogin(params, cmd){
var request = new Http('myurl'  + params.token+'&proId='+params.proId);
request.getContent(function(result) { //call the PHP file
if ( ! result ) {
//send error if cannot contact page
cmd.sendResponse('ERR', {'code': 1001, 'value': 'error_codes._1001'});
Ape.log('USER_NOT_LOGGED_IN');
return 0;
}
var result2=JSON.parse(result);
if(result2.res == 'in auction'){
Ape.log('USER_LOGGED_IN');
Ape.addUser(cmd.user);
return 1;
}
else {
//send error if not logged in
cmd.sendResponse('ERR', {'code': 1001, 'value': 'error_codes._1001'});
Ape.log('USER_NOT_LOGGED_IN');
return 0;
}
});
}

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

Reply via email to