欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

discuz調(diào)用函數(shù)實(shí)現(xiàn)同步登錄與退出核心代碼

  發(fā)布時(shí)間:2013-09-13 18:01:25   作者:佚名   我要評(píng)論
登錄與退出實(shí)現(xiàn)同步的問(wèn)題困擾了好久,忙里偷閑將部分代碼抽取出來(lái),寫(xiě)成函數(shù),這樣以后登錄與退出只要調(diào)用一下這兩個(gè)函數(shù)就可以,小鳥(niǎo)你們幸福了,感興趣的朋友可以學(xué)習(xí)下哦
這個(gè)問(wèn)題折磨了好久,今天特意抽出一些時(shí)間來(lái)看看discuz的源代碼,將部分代碼抽取出來(lái),寫(xiě)成函數(shù),這樣以后登錄與退出只要調(diào)用一下這兩個(gè)函數(shù)就可以了。

復(fù)制代碼
代碼如下:

//退出Discuz賬號(hào)
function discuz_logout(){
require './bbs/source/class/class_core.php'; //引入系統(tǒng)核心文件
$discuz = & discuz_core::instance(); //以下代碼為創(chuàng)建及初始化對(duì)象
$discuz->cachelist = $cachelist;
$discuz->init();
require libfile('function/member');
require libfile('class/member');
$_GET['formhash'] = $_G['formhash'];
$ctl_obj = new logging_ctl();
$ctl_obj->setting = $_G['setting'];
$method = 'on_logout';
//$ctl_obj->template = 'member/login';
$ctl_obj->$method();
echo "成功退出!".time();
}
//登錄Discuz賬號(hào)
function discuz_login($username,$password){
require 'E:/ku25.com/wwwroot/bbs/source/class/class_core.php'; //引入系統(tǒng)核心文件
$discuz = & discuz_core::instance(); //以下代碼為創(chuàng)建及初始化對(duì)象
$discuz->cachelist = $cachelist;
$discuz->init();
require libfile('function/member');
require libfile('class/member');
$_GET['formhash'] = $_G['formhash'];
$_GET['from'] = 1;
$_GET['loginsubmit'] = $_GET['infloat'] = 'yes';
$_GET['cookietime'] = '2592000';
$_GET['username'] = $username;
$_GET['password'] = $password;
$ctl_obj = new logging_ctl();
$ctl_obj->setting = $_G['setting'];
$method = 'on_login';
//$ctl_obj->template = 'member/login';
$ctl_obj->$method();
echo "成功登錄!".time();
}

相關(guān)文章

最新評(píng)論