Solved

Any way to "share" PHP session variables between two domains?

Posted on 2011-03-23
3
301 Views
Last Modified: 2012-05-11
We have two websites featuring two aspects of our business: metrology and robotics. As these two are related, we have many links between these two sites, and they are designed to work seamlessly - they even look similar.
We don't have any LOG IN forms on either one of the sites, but, we have "quote request" forms for different items. Many times, a customer will fill out their info in one of the forms and request the quote, I would save their contact info in PHP session variables and when they move onto another quote request during the same visit, their contact info is pre-filled in the form.  It is convenient to the customer, but...

but, of course, once they leave one site and go to our other site, the session variables are lost.

Is there any way to retain the session variables values between two sites?
0
Comment
Question by:Erie_Laker
  • 2
3 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 35202085
No, not without explicitly transferring them.  You would have to read them all and pass them via a POST to the other site.

The other choice is to put all that in a database which you can share between sites.  You would have to come up with another way to track the customer but that's doable.
0
 

Author Comment

by:Erie_Laker
ID: 35301581
@Dave
"The other choice is to put all that in a database which you can share between sites.  You would have to come up with another way to track the customer but that's doable."

Could you please explain how?
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 35301733
You can set up databases like MySQL and MS SQL so they can be accessed from anywhere with a username and password.  I edit the databases on my websites from a page running on the webservers here at home.  The database server(s) is independent from the web servers.

So if you save the original info from either site in the database, you can access it again when your customer goes to the other site.  You would still have to come up with a way to recognize them because cookies and session data don't transfer between sites.  Some kind of login in the original quote form would do.  Note that once it's in the database, it doesn't disappear with the customer and you can access it later if you want to.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now