tags:

views:

46

answers:

2

Hi ...., I've deployed simple machine forum at smf.com domain, and than I created simple application to read session from the smf.com, but i deployed the simple application in the subdoamin, let say I put my simple application in simple.smf.com

In order to read session from domain, I must put ini_set("session.cookie_domain",".smf.com"); before session start. I must put it in the smf project file and also simple aplication too.

where I should put ini_set("session.cookie_domain",".smf.com") so it will by pass to the session start.

I have put the ini_set("session.cookie_domain",".smf.com") in the load.php file

function loadSession()
{
   global $HTTP_SESSION_VARS, $modSettings, $boardurl, $sc;

   // Attempt to change a few PHP settings.
   @ini_set("session.cookie_domain",".smf.com");
   @ini_set('session.use_cookies', true);
   @ini_set('session.use_only_cookies', false);
   @ini_set('url_rewriter.tags', '');
   @ini_set('session.use_trans_sid', false);
   @ini_set('arg_separator.output', '&');
}

while I try to read cookie form subdomain. It couldn't read the domain session. my subdomain code is:

<?php 
 ini_set("session.cookie_domain",".smf.com");
 session_start();

 print_r($_SESSION);
?>
A: 

You can set it in the php.ini file or in a .htaccess

php_value session.cookie_domain ".smf.com"

You could also try placing the ini_set at the top of the index.php, however it would only work for pages called from the index.php

Scott
A: 
  1. check Use subdomain independent cookies in the server setting of simple machine forum.
  2. include the SSI.php to my site, the code is:

    include("../SSI.php");

    if ($context['user']['is_guest']) { ssi_login(); } else { //You can show other stuff here. Like ssi_welcome(). That will show a welcome message like. //Hey, username, you have 552 messages, 0 are new. ssi_logout(); }

adisembiring