Closed hanynowsky closed 9 years ago
@hanynowsky It's on the main page for this repo.
1) In say login.php, bootstrap your site and pass provided username and password to the XMPP_Prebind constructor.
2) If login is successful you receive:
$sessionInfo = $xmppPrebind->getSessionInfo(); // array containing sid, rid and jid
3) Store
$sessionInfo['rid'], $sessionInfo['sid'] and $sessionInfo['jid']
to say $_SESSION, or wherever.
4) In the page after login.php, i.e. index.php, you once again bootstrap your site, include all the Candy JS, and attach to the session using:
Candy.Core.attach('<?php echo $_REQUEST['jid'] ?>', '<?php echo $_REQUEST['sid'] ?>', '<?php echo $_REQUEST['rid'] ?>');
Please keep in mind that this example is extremely simplified. You really need to check the variables properly and also when auth()
is ran, make sure it gives you boolean true as result before attempting to read session-info or redirecting to any page.
Can yu please give a clearer example on how to integrate this plugin to the Candy chat. I cannot make it work. MAybe I did not understand how I should call the lib and where I should put the code.