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 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 java 的protected权限 ,问题在注释里
  • ¥15 这个是哪里有问题啊?