UserController.php
<?php
class UserController extends BaseController {
/**
* Login
*/
function loginAction() {
$this->view->message = '';
if ($this->_request->isPost()) {
Zend_Loader::loadClass('Zend_Filter_StripTags');
$f = new Zend_Filter_StripTags();
$username = $f->filter($this->_request->getPost('username'));
$password = $f->filter($this->_request->getPost('password'));
$password = md5($password);
$this->user->Login($username,$password);
if ($this->user->isLogin) { //User logged-in successfully
/** Integration of Discuz BBS **/
$time = time();
$row = $this->user->fetchRow("username = '$username'");
$email = $row->email;
$autharray = array(
'time' => $time,
'username' => $username,
'password' => $password,
'email' => $email
);
$passport_key = 'bppyc368twdf'; //Your key
$action = 'login';
$auth = passport_encrypt(passport_encode($autharray), $passport_key);
$verify = md5($action.$auth.$forward.$passport_key);
$locationStr = "http://www.yoursite.com/bbs/api/passport.php".
"?action=$action".
"&auth=".rawurlencode($auth).
"&verify=$verify";
$this->_redirect($locationStr);
}
}
}
}
?>