RE: [PHP] sessions vs domain problem
| From: | Vincent DUPONT | Date: | Fri, 22 Dec 2006 12:12:22 +0000 |
| Subject: | RE: [PHP] sessions vs domain problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246147@lists.php.net to get a copy of this message | ||
Hello,
As far as I know, the session will use a cookie, and the cookies are linked to one domain name.
I don't know a way of using a cookie accross multiple domains, but I guess this should be
possible.
The question is : will PHP allow you to do that? I guess no because this could be a security
issue...
maybe someone in the list can help.
search the web for the cookie accross multipple domain.
Vincent
(greetings from Belgium !!)
-----Original Message-----
From: Reinhart Viane [mailto:rv@domos.be]
Sent: Fri 22/12/2006 12:52
To: php-general@lists.php.net
Subject: [PHP] sessions vs domain problem
Hello,
I have the folowing problem :
Hosting of my site is at http://www.groep6049.ksjnet.be
<http://www.groep6049.ksjnet.be/>
My domainname is www.ksachiropoelkapelle.be
<http://www.ksachiropoelkapelle.be/>
I have forwarded www.ksachiropoelkapelle.be
<http://www.ksachiropoelkapelle.be/> towards
http://www.groep6049.ksjnet.be/index.php
I use cloaked forwarding (so ksachiropoelkapelle stays in the address bar)
Now people can log in on that site:
$sql="select * from users where user_firstname='$firstname' and
user_password='$password'";
$result=mysql_query($sql) or die(mysql_error());
$count=mysql_num_rows($result);
if ($count>0) {
$row=mysql_fetch_array($result);
$userid=$row["user_id"];
$gebruikersnaam=$row["user_firstname"];
//set the session variables
$_SESSION['userid']=$userid;
$_SESSION['gebruikersnaam']=$gebruikersnaam;
header("Location: http://www.ksachiropoelkapelle.be/index.php");
}
The problem is:
When I surf directly to http://www.ksachiropoelkapelle.be
<http://www.ksachiropoelkapelle.be/> and try
to login nothing happens. The
script is executed successfully but it does not seem to recognize the
$_SESSION to show that I'm logged in.
When I surf to http://www.groep6049.ksjnet.be/index.php and try
to login it
works perfectly.
Is it possible to set something extra in my php session variables to make it
work when surfing directly to http://www.ksachiropoelkapelle.be
<http://www.ksachiropoelkapelle.be/> ?
Or do I have to disable the cloaking?
Thanks in advance,
Reinhart Viane