Can't get PHP scripts to work at all.
Maybe you could post the code you are trying and someone can help.
Can't get PHP scripts to work at all.
<?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";
looks like a layer 8 problem since you aren't able to declare your problem.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.
Declare it this way and try again:
Code:XenForo_Session::startPublicSession(); $visitor = XenForo_Visitor::getInstance()->toArray(); if($visitor['user_id']){ ... }
<?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";
?>
it was Cloudflare detect who made that error, thanks. (now i must only find a way to get the real ip in xenforo #done)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
Do that with PHP.it was Cloudflare detect who made that error, thanks. (now i must only find a way to get the real ip in xenforo)
No, the add-on is only compatible with XenForo 1.Will this still work for Xenforo 2.0?
Is there anything like this for Xenforo 2.0?No, the add-on is only compatible with XenForo 1.
We use essential cookies to make this site work, and optional cookies to enhance your experience.