簡體   English   中英

Vanilla Forums SSO php未登錄論壇

[英]Vanilla Forums SSO php not logging in to forum

香草論壇2.3

我已經多次這樣做了,我幾乎查看了所有可以找到的文檔,但是我被卡住了。

我已經下載了最新版本的vanilla,我已經下載了最新版本的jsconnect插件。

我在管理區域的jsconnect插件設置中設置了所有配置

jsConnect設置

登錄URL http://localhost/site/login.php

注冊網址 http://localhost/site/register.php

注銷URL http://localhost/site/logout.php

位於 http:// localhost / site / forums /的論壇

身份驗證URL http://localhost/site/includes/auth.php

所以我登錄我的網站一切都很棒我點擊論壇它說我沒有登錄。

我的登錄頁面功能

function login_user($email, $password){

    $active = 1;

    $db = dbconnect();
    $stmt = $db->prepare('SELECT * FROM users WHERE email = ? AND active= ?');
    $stmt->bind_param('si', $email, $active);
    $stmt->execute();
    $result = $stmt->get_result();

    if ($result->num_rows == 1) {
        $row = $result->fetch_array();

        $id = $row['id'];
        $email = $row['email'];
        $username = $row['username'];
        $db_password = $row['password'];

        isset($_POST['remember']) ? $remember = $_POST['remember'] : $remember = "";

        if (password_verify($password, $db_password)) { 

            $_SESSION['id'] = $id;
            $_SESSION['email'] = $email;
            $_SESSION['username'] = $username;

            $fingerprint = md5($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']);
            $_SESSION['last_active'] = time();
            $_SESSION['fingerprint'] = $fingerprint;

           if($remember === "yes"){
            rememberMe($id);
             }

            return true;
        } else {
            return false;
        }
        return true;
    } else {
        return false;
    }
}

我的authenticate.php

<?php

include_once '../db/db.php';
include_once '../db/functions.php';
require_once '../vanilla/plugins/jsconnect/functions.jsconnect.php';



// 1. Get your client ID and secret here. These must match those in your jsConnect settings.
$clientID = "xxxxx";
$secret = "xxxxxxxxxx";



// 2. Grab the current user from your session management system or database here.
$signedIn = true; // this is just a placeholder

if($_SESSION['id'])
    $signedIn = true;


// 3. Fill in the user information in a way that Vanilla can understand.
$user = array();


if ($signedIn) {
   // CHANGE THESE FOUR LINES.

  $user['uniqueid'] = $_SESSION['id'];
  $user['name'] = $_SESSION['username'];
  $user['email'] = $_SESSION['email'];  

}

// 4. Generate the jsConnect string.

// This should be true unless you are testing. 
// You can also use a hash name like md5, sha1 etc which must be the name as the connection settings in Vanilla.
$secure = true; 

WriteJsConnect($user, $_GET, $clientID, $secret, $secure);

exit();

?>

您似乎無法在此頁面上開始您的會話,您必須嘗試以下操作

<?php
session_start();

include_once '../db/db.php';
include_once '../db/functions.php';
require_once '../vanilla/plugins/jsconnect/functions.jsconnect.php';

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM