Re: PHP and cookies and/or headers
| From: | Chris Lee | Date: | Fri, 16 Feb 2001 00:11:43 +0000 |
| Subject: | Re: PHP and cookies and/or headers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-40005@lists.php.net to get a copy of this message | ||
Ive done this, our secure server is on a differnt IP/domain name, of course
I still need cookies though.
<?php
include_once('time.egn');
if ( isset($HTTP_GET_VARS['PHPSESSID']) )
session_id($HTTP_GET_VARS['PHPSESSID']);
if ( isset($HTTP_POST_VARS['PHPSESSID']) )
session_id($HTTP_POST_VARS['PHPSESSID']);
session_start();
if (!isset($HTTP_SESSION_VARS['SessionID']))
{
$SessionID = mtime();
session_register('SessionID');
}
if (!isset($PHPSESSID))
$PHPSESSID = session_id();
$SID = "PHPSESSID=$PHPSESSID";
?>
All I have todo to set the SessionID ona different domainname is pass the
PHPSESSID in the url to the new host, and voila I have access to the same
SessionID and other session vars. give it a shot, im sure this will work for
you. if not please give me an email, I will help you.
--
Chris Lee
Mediawaveonline.com
em. lee@mediawaveonline.com
ph. 250.377.1095
ph. 250.376.2690
fx. 250.554.1120
"Jeremy Gillies" <jgillies@cupw-sttp.org> wrote in message
news:60A76E02BB9CD311930B00805F6565984BF25C@ldap.cupw-sttp.org...
> Greetings,
>
> Is anyone REALLY familiar with PHP and cookies and/or headers-- I have a
> tough nut to crack and it involves three URLs.
>
> Here is the situation, and I really want to avoid using our DB if I can.
>
> I have a main URL that everyone will probably hit - splash page.
> www.mainurl.com
>
> From there, users go into either the french or english version of the site
> with two unique URLs...
>
> www.english.com
> www.francais.com
>
> I want it so that if users go back to the splash page, it will pick up
their
> language preference (french or english) and send them to the index page of
> either www.english.com or www.francais.com -- depending upon the last
> argument set when they were last at the site. So, if they ended on an
> english page, they would start at the english index page, but if the
> finished on a french page, they would start on the french index page.
>
> The problem with cookies is the fixed URL from which they can be read.
> Obviously www.mainurl.com cannot read a cookie set by www.francais.com --
so
> how can I over come this.
>
> I suppose I could do it via IP stored in a DB, but even then there is a
> problem as people who hide behind one IP -- say a large business --
> would be stuck using each others' preferences depending upon who used the
> site last.
>
> I also do not want the user to have to type in a code word so that the
> IP is tagged with a special identifier. I suppose I could use a random
> number generated from a time stamp... but I really want to avoid using a
DB!
> -- mostly for speed and bloat of page size reasons.
>
> Thanks in advance!
> Jeremy
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>