Ok,
I made the following script
Script 1
PHP Code:
<?php
require_once('./global.php');
$PRIVILIGED = array("5", "6", "7"); // Super Moderator, Admin, Moderator
$TRUSTED = array("9", "10", "11"); // Wiki, VIP, Special
$ALLOWED = False; // Default not logged-in and not priviliged/trusted
// Check if user is logged in
if ($vbulletin->userinfo['userid']!=0)
{
if (in_array($vbulletin->userinfo['usergroupid'], $PRIVILIGED))
$ALLOWED = True;
if (!$ALLOWED)
{
$memberships = explode(',',$vbulletin->userinfo['membergroupids']);
foreach($memberships as $membership)
if (in_array($membership, $TRUSTED))
{
$ALLOWED = True;
break;
}
}
}
if ($ALLOWED)
$var = $vbulletin->userinfo['username'].','.$vbulletin->userinfo['userid'];
else
$var= 'no';
echo $var;
?>
This works fine when I execute it directly from my browser.
But I need to call script1 from another domain. Script1 above is actually placed in one subdomain like sub1.mysite.com and I need to call script1 from script2 in another subdomain like sub2.mysite.com.
Script 2
PHP Code:
<?php
ob_start();
include 'http://sub1.mysite.com/script1.php';
$contents = ob_get_contents();
ob_end_clean();
echo $contents;
?>
But this fails!
When script 2 calls script 1 it echos "no" even though calling script1 directly returns a username and id. I found out that script1 fails at "
PHP Code:
if ($vbulletin->userinfo['userid']!=0)
The VB3.53 has its cookie set to ".mysite.com", so that should be ok.
What am I missing here?