Kotomi - Generic script bridge

Kotomi - Generic script bridge 0.0.1

No permission to download
Hey,
i have a Problem with my custom php page to include the session.

Content:

PHP:
<?php
 
$startTime = microtime(true);
$kotomi_indexFile = "./";
$kotomi_container = true;
$fileDir = dirname(__FILE__)."/{$kotomi_indexFile}";
require "{$fileDir}/library/Dark/Kotomi/KotomiHeader.php";



XenForo_Session::startPublicSession(new Zend_Controller_Request_Http);

$visitor = XenForo_Visitor::getInstance();

if ($visitor['user_id'])
{
    echo 'IS LOGGED IN';
}
else
{
    echo 'IS NOT';
}
print_r($visitor);

require "{$fileDir}/library/Dark/Kotomi/KotomiFooter.php";


The Problem is evry time when i go to the Site it clear the session (i know that "XenForo_Session::startPublicSession" does that)
Is there a way to get if the user logged in here anymore, or is it my fault? (Xenforo Version 1.5.13)

Faithfully,
Ezamik
 
Declare it this way and try again:
Code:
XenForo_Session::startPublicSession();
$visitor = XenForo_Visitor::getInstance()->toArray();
if($visitor['user_id']){ ... }
 
Still unable to get this to work for anything beyond basic HTML echos, which is pointless since I don't need an addon to do that.

Can't get PHP scripts to work at all.

Doesn't matter what I do, the last require doesn't do anything, it just takes the last line, and pretty much echos it at the bottom of whatever I do.

Sucks that we can't add PHP to the design easily. This was a bit of a work around in VB, but at least it worked.
looks like a layer 8 problem since you aren't able to declare your problem.
 
Declare it this way and try again:
Code:
XenForo_Session::startPublicSession();
$visitor = XenForo_Visitor::getInstance()->toArray();
if($visitor['user_id']){ ... }

It clear's the session again on loading the page, so same problem. Should it be in a specific directory? (Have it as this time in the main directory with the forum)
 
does i understand that correct, you load the page and your login session will be cleared which means, you will be logged out on loading your custom page?
 
Correct, but the session will be hold if i delete "XenForo_Session::startPublicSession();" , but than the php script isnt working, ofcourse.
 
Just tried it with this Code, which works like a charm:
PHP:
<?php

$startTime = microtime(true);
$kotomi_indexFile = "./";
$kotomi_container = true;
$fileDir = dirname(__FILE__)."/{$kotomi_indexFile}";
require "{$fileDir}/library/Dark/Kotomi/KotomiHeader.php";
XenForo_Session::startPublicSession();
$visitor = XenForo_Visitor::getInstance()->toArray();

echo "<pre>";
print_r($visitor);
echo "</pre>";

require "{$fileDir}/library/Dark/Kotomi/KotomiFooter.php";
?>

I can refresh the Page without Problems; still logged in.
Do you have other Code between the both "requires" from Kotomi?
Can you please disable all Addons and try it again?

Edit: And please don't use "if(isset($visitor['user_id']))" because the user_id is zero (number) when you're not logged in
 
Just tried it with this Code, which works like a charm:
PHP:
<?php

$startTime = microtime(true);
$kotomi_indexFile = "./";
$kotomi_container = true;
$fileDir = dirname(__FILE__)."/{$kotomi_indexFile}";
require "{$fileDir}/library/Dark/Kotomi/KotomiHeader.php";
XenForo_Session::startPublicSession();
$visitor = XenForo_Visitor::getInstance()->toArray();

echo "<pre>";
print_r($visitor);
echo "</pre>";

require "{$fileDir}/library/Dark/Kotomi/KotomiFooter.php";
?>

I can refresh the Page without Problems; still logged in.
Do you have other Code between the both "requires" from Kotomi?
Can you please disable all Addons and try it again?

Edit: And please don't use "if(isset($visitor['user_id']))" because the user_id is zero (number) when you're not logged in
it was Cloudflare detect who made that error, thanks. (now i must only find a way to get the real ip in xenforo #done)
 
Isn't that pretty much the same as using a callback function on a XF generated page which then includes any script of your choice?
 
@Luke F - any possibility I can disable XenForo gzip/compression for scripts Kotomi is launching? It appears to break my wordpress install when any performance/caching plugs are enabled, causing the whole site to load garbled:
1533238178433.webp
 
would love this for xf2
Any way to replicate this on XenForo 2.0?
 
Top Bottom