[SOLVED] session problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sazzad
Forum Newbie
Posts: 5
Joined: Sun Jul 18, 2004 12:09 am
Location: Dhaka, Bangladesh

session problem

Post by sazzad »

hello,

can anyone tell me how can i use my session in multiple subdomain.

I use this code to register my session.

<?php
session_start();
$_SESSION['id'] = "1";
$_SESSION['username'] = "username";
$_SESSION['password'] = "password";

?>

but it does not work in subdomain. I wan to use this session in subdomain.

??????????
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

make sure the cookie is set with a domain of .mydomain.com and a path of /

yes that is a dot in front of mydomain.com
sazzad
Forum Newbie
Posts: 5
Joined: Sun Jul 18, 2004 12:09 am
Location: Dhaka, Bangladesh

Post by sazzad »

How can i set my cookie with domain ???

Do you have any example????
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

[php_man]setcookie[/php_man]
sazzad
Forum Newbie
Posts: 5
Joined: Sun Jul 18, 2004 12:09 am
Location: Dhaka, Bangladesh

Post by sazzad »

Actually I do not want to use cookie.
Is there any why with using SESSION ?????
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

yours is using a cookie..
sazzad
Forum Newbie
Posts: 5
Joined: Sun Jul 18, 2004 12:09 am
Location: Dhaka, Bangladesh

Post by sazzad »

oppps :oops:


Thank you feyd for your help.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you can alter the domain and path the session system uses in it's cookie with session_set_cookie_params() and session_get_cookie_params()
sazzad
Forum Newbie
Posts: 5
Joined: Sun Jul 18, 2004 12:09 am
Location: Dhaka, Bangladesh

Post by sazzad »

:D my code working now.

Thanks again feyd.
Post Reply