/** * @param array $data */ public function OnWebLogout(array $data) { if (!defined('SMF') || SMF != 'API') { return; } if (!smfapi_getUserByUsername($data['user']->username)) { if (!$this->addUserToSMF($data['user']->username)) { return; } } smfapi_logout($data['username']); @session_write_close(); }
<?php require_once dirname(__FILE__) . '/vendors/smf/smf_2_api.php'; if (isset($_REQUEST["username"])) { $username = rawurldecode($_REQUEST["username"]); $outed = true; // for debug // $isonline=smfapi_isOnline($username)?'T':'F'; if (smfapi_isOnline($username)) { $outed = smfapi_logout($username); } if (!$outed) { echo "<script type='text/javascript'>alert('Sorry! Failed to logout zhaohu forum! Please click logout at zhaohu forum.')</script>"; } } header("Location: http://{$_SERVER['HTTP_HOST']}");
/** * Short description * * Long description * * @param * @return */ protected function logout_user() { try { $this->loadApi(); } catch (Exception $e) { throw new \Exception($e->getMessage()); } $this->data = smfapi_logout($this->username); }