Page 1 of 1

session problem

Posted: Sun Jul 18, 2004 12:09 am
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.

??????????

Posted: Sun Jul 18, 2004 12:12 am
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

Posted: Sun Jul 18, 2004 12:26 am
by sazzad
How can i set my cookie with domain ???

Do you have any example????

Posted: Sun Jul 18, 2004 12:27 am
by feyd
[php_man]setcookie[/php_man]

Posted: Sun Jul 18, 2004 12:32 am
by sazzad
Actually I do not want to use cookie.
Is there any why with using SESSION ?????

Posted: Sun Jul 18, 2004 12:35 am
by feyd
yours is using a cookie..

Posted: Sun Jul 18, 2004 12:39 am
by sazzad
oppps :oops:


Thank you feyd for your help.

Posted: Sun Jul 18, 2004 12:42 am
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()

Posted: Sun Jul 18, 2004 1:07 am
by sazzad
:D my code working now.

Thanks again feyd.