Forums

PHP

This topic is locked

sending session variable across subdomains

Posted 06 Jan 2003 21:02:13
1
has voted
06 Jan 2003 21:02:13 Justin B posted:
I am creating a login page that, when login is successful, stores the session variable $valid_user.

The problem is that the login page is accessed on a connection and the rest of the site, including pages which check for the $valid_user session variable, are on a domain.

Is there anyway to pass a session variable between different subdomains? If not, what kind of workaround can I use?

By the way, the login script is authenticating correctly, the session variable just isn't getting sent between the subdomains.

I checked the rest of the PHP forum, but there doesn't seem to be an answer to his.

Thanks in advance,
Justin

Replies

Replied 13 Jan 2003 11:46:40
13 Jan 2003 11:46:40 Julio Taylor replied:
jrbarkhu,

PHP automatically creates a sessionvar called KT_Username whenever you log in. You recall this var, but you'll need to add the following code to your page header:
<pre id=code><font face=courier size=2 id=code>
&lt;?php
session_start()
?&gt;
</font id=code></pre id=code>
then you can call the <i>KT_Username</i> session var like so:
<pre id=code><font face=courier size=2 id=code>&lt;?php echo $HTTP_SESSION_VARS["KT_Username"]?&gt;</font id=code></pre id=code>

hope it helps a little

------------------------
Julio

PHP | MySQL | UD4

ICQ: 19735247

Edited by - poolio on 13 Jan 2003 11:47:28

Reply to this topic