Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Subdomain read domain session
Old 01-12-2010, 09:41 AM Subdomain read domain session
Novice Talker

Posts: 10
Name: adi sembiring
Trades: 0
Hi ....
I create two application, let say my first application called mastersite, and the second application called childesite. I store the childesite project under the mastersite project directory.

I create virtual host in my apache server, and the document root of the directory point to masterproject directory supposed the virtual host name is www.mastersite.com. after that i create sub domain of virtual host supposed the subdomain of virtual host name is, www.childesite.mastersite.com.

while www.mastersite.com is opened by a browser, the application stored the dummy data to its session. Supposed I name it to dummy_data, and the dummy_data set to '123'. dummy_data = '123';

while www.childesite.mastersite.com is opened, it will read the dummy_data from the mastersite.com domain and print out the dummy_data to the browser. but The www.childesite.mastersite.com is blank, because it can't read the domain session.

but, if i try open the childesite using www.mastersite.com/childesite the dummy data will be printed out to the browser.

why these thing could by happened ?
gun41zuntuk is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-12-2010, 11:58 AM Re: Subdomain read domain session
lazcorp's Avatar
Average Talker

Posts: 22
Name: Martin
Trades: 0
Before session_start you have to set session params:

session_set_cookie_params(0,'/','mastersite.com');

BUT this must be set when the browser points to mastersite.com AND NOT www.mastersite.com
lazcorp is offline
Reply With Quote
View Public Profile
 
Old 01-12-2010, 12:05 PM Re: Subdomain read domain session
Novice Talker

Posts: 10
Name: adi sembiring
Trades: 0
I've tried to set session_set_cookie_params(0,'/','mastersite.com'); before session start in the childesite file. but The program still can't read the domain session.

Could you give me more detail explanation about this ?
gun41zuntuk is offline
Reply With Quote
View Public Profile
 
Old 01-12-2010, 07:07 PM Re:[solved] Subdomain read domain session
Novice Talker

Posts: 10
Name: adi sembiring
Trades: 0
put ini_set("session.cookie_domain",".mastersite.biz") ; in the domain and subdomain program before session started
gun41zuntuk is offline
Reply With Quote
View Public Profile
 
Old 01-12-2010, 07:09 PM share simple forum machine session to subdomain
Novice Talker

Posts: 10
Name: adi sembiring
Trades: 0
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
PHP Code:
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 Code:
<?php 
 ini_set
("session.cookie_domain",".smf.com");
 
session_start();

 
print_r($_SESSION);
?>
gun41zuntuk is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Subdomain read domain session
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22592 seconds with 12 queries