我正在爲一個社區開發一個小型的手工門戶網站,我希望它有一個帶有IP.Board的登錄系統(對於最終用戶來說更簡單)。IP.Board - 單點登錄在PHP
我有論壇和應用程序在同一個主機上。 對於洛,用戶點擊一個按鈕,會被重定向到這個頁面:
<?php
require_once '../www/forum/init.php';
include_once 'includes/functions.php';
error_reporting(E_ALL);
session_start();
\IPS\Session\Front::i();
print_r(\IPS\Member::loggedIn());
if(\IPS\Member::loggedIn()->member_id) {
$name = \IPS\Member::loggedIn()->name;
if(checkUserExistance($name)==0){
//header("Location: ../index.php");
print("LOGED EXIT!!!!!!!!!!!!!!!!!!!!");
}else{
print("LOGED INNNN!!!!!!!!!!!!!!!!!!!!");
$_SESSION['authenticated'] = 'yes';
$_SESSION['user'] = $name;
$userphoto = \IPS\Member::loggedIn()->photo;
$result = getUserData($_SESSION['user']);
$_SESSION['isLeader'] = $result['isLeader'];
$_SESSION['isAdmin'] = $result['isAdmin'];
}
} else{
print("LOGED OUT!!!!!!!!!!!!!!!!!!!!");
$_SESSION['authenticated'] = 'no';
if(session_destroy()){ // Destroying All Sessions
//header("Location: index.php");
}
}
//echo "Auth by LOGIN";
>
如果IP.Board會議(論壇)沒有登錄,它可以追溯到index.php
現在我正在開發它的一個基本版本,當我得到這個工作時會做更多的改進。
正如你所看到的,我有一個print
用於調試一些數據。 對邊緣一切正常,但在Firefox或鉻我得到一個32個字符的字符串,每次不同的一個,而不是獲取用戶名。 我得到的例子Firefox和Chrome。
ef5cd2de05387b9b01048efad2173efd
是否有任何人知道這是爲什麼?
信息:我也跟着:IP.Board SSO Documentation
INFO2:Forum post
我使用的是IPS社區套件作爲 「主人」。
EDIT 1:調試\IPS\Member::loggedIn()
IPS \成員對象([結點類別:保護] => IPS \獎勵\貓 [_followData] => [_previousPhotoType:保護] = > [_group] => [restrictions:protected] => [modPermissions:protected] => [calculatedLanguageId:protected] => [markers] => Array() [markersResetTimes:protected] => Array()[haveAllMarkers :受保護] => [defaultStreamId:受保護的] => [changedCustomFields] => Array()[previousName:protected] => [_socialGroups:protected] => [sessionData:protected] => [_lang:protected] => [_url:protected] => [profileFields ] => [_reputationData:protected] => [_following:protected] => Array()[reportCount:protected] => [ignorePreferences:protected] => [_ppdLimit:protected] => [_data:protected] = > Array([member_group_id] => 2 [mgroup_others] => [joined] => 1483440989 [ip_address] => 83.36.150。111 [時區] => UTC [allow_admin_mails] => 1 [pp_photo_type] => [member_posts] => 0 [pp_main_photo] => [pp_thumb_photo] => [failed_logins] => [pp_reputation_points] => 0 [簽名] => [auto_track] => {「content」:0,「comments」:0,「method」:「immediate」})[_new:protected] => 1 [changed] => Array([member_group_id] => 2 [mgroup_others] => [joined] => 1483440989 [ip_address] => 83.36.150.111 [timezone] => UTC [allow_admin_mails] => 1 [pp_photo_type] => [member_posts] => 0) [ )
我們無法回答你。您必須顯示'\ IPS \ Member :: loggedIn()'和底層方法的來源。 – Xatenev
@Xatenev多數民衆贊成在論壇的代碼的一部分,我不知道它在哪裏。它說,我必須導入'init.php'文件,以便與IP.Board的SSO一起工作。 https://invisionpower.com/4docs/advanced-usage/development/single-sign-on-sso-r98/ –