dongqiao8421 2014-04-01 10:01
浏览 12
已采纳

如何从外部注销IPB用户?

I have built a SSO (Single Sign-On) system for use between our main site and the Invision Power Board software but I'm not sure how to go about logging the user out of IPB when they log out from the main site?

Additionally, what files would I need to load in the external file to be able to do this?

  • 写回答

2条回答 默认 最新

  • doumen5491 2014-04-06 16:39
    关注

    Edit: to use IPB code for this, you have to include

    require_once( IPS_ROOT_PATH . 'applications/core/modules_public/global/login.php' );

    then to extend public_core_global_login and to call it's doLogout() method for this to work you have to set $this->member->setMember( $member_id ); I, personally, have never done it this way, so bellow is how you can do it manually:

    IPB sets the data in session and stores several cookies for auto-login. You can perform without using any IPB sources; what you have to do is (note query and updatecookie are some pseudofunctions, for performing DB queries and setting cookie values respectively):

      query("DELETE FROM ".$ibf_prefix."sessions WHERE member_id = $userid");
    
      updatecookie($ibf_cookieid."member_id",0,time()-1800);
      updatecookie($ibf_cookieid."pass_hash",0,time()-1800);
      updatecookie($ibf_cookieid."session_id",0,time()-1800);
    

    You can read $ibf_prefix from conf_global.php :

    $ibf_prefix = $INFO[sql_tbl_prefix];
    

    and $ibf_cookieid is:

    $ibf_cache = query_first("SELECT cs_value FROM " . $ibf_prefix . "cache_store WHERE cs_key = 'settings'");
    $ibf_cache = unserialize($ibf_cache['cs_value']);
    
    $ibf_cookieid = $ibf_cache['cookie_id'];
    

    You can read the source of doLogout method in admin/applications/core/modules_public/global/login.php

    I'm not aware of any IPB API for this.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大