When sending the user to a checkout page, they are switched from http://sitename.com
to https://sitename.com
.
As a result, $_SESSION
variables are lost.
The site has a valid SSL certificate which may or may not be of some use.
When sending the user to a checkout page, they are switched from http://sitename.com
to https://sitename.com
.
As a result, $_SESSION
variables are lost.
The site has a valid SSL certificate which may or may not be of some use.
You can't pass session values between different domains. You must use http post-get or a database to pass your values. For security, you can concat all your values in a string and use
and post it alongside your values and calculate the sha1 for the values other page gets, then compare the hashes.
Post method on different domains cause browsers to show a security message, so don't use that.
Using url for get method is not safe, you would need to ask for a password on the redirected page for allowing the get parameters in your system.
Do not use cookies if you need security.
The way I am suggesting is, save the values in a database and generate a key, then make your redirection link using your key, forward the users page with a get parameter which has the key, then the page user is redirected to gets that key, fetches the data and removes the key. you can generate a key with sha1
this is pretty secure.
the things that can happen: a script entering random values for the parameter "key" to make your website load the data into your memory?
This is not going to happen because you delete the entry after using it. Some common misconception is that get values are unsafe and should always be avoided.
you can set the table engine type to "memory" in mysql if you want performance perfection.
I'd recommend, in addition to what most have stated here about transferring encrypted information, looking at it the same as if you were transferring sensitive information through a 3rd party API. How do you know someone isn't spoofing the request? There are many protocols for truly confirming the authenticity of the request, depending on how sensitive your setup is. You're opening yourself up to accounts being compromised if you're not careful.
Even though it's on the same server, consider this:
When someone is following the link, form action, etc. that passes over the encrypted key, what would prevent someone from sniffing it BEFORE they get to the secured version of your site? If I were at a public WIFI spot, that wouldn't be too far-fetched. I could pretend to be your site, reroute requests to my own laptop, grab the token, and redirect the visitor back to where they came. They would assume it was a glitch, and would have no idea. Now I can login as them, and possibly go buy $10,000 worth of stuff with their credit card on file and ship it somewhere else. The degree of caution you take here should match the degree of sensitivity.
Also, make sure you expire your tokens (one use only, after X number of seconds, etc), but I would also consider using the Post-Redirect-Get pattern on both ends, i.e.:
Don't show the direct link on a page or in the form of the unsecured site, but show a link that will then redirect on the backend (and handle all the token/encryption stuff). When you arrive at the secured version, do the same (don't leave a "?token=asdfjalksfjla" parameter just sitting there in the URL; redirect it).
So, formal token-based systems were designed to solve this very problem, but implementing OAuth just for this might be overkill. Spend some time planning the potential vulnerabilities before executing. Just because it'd be really hard to guess the token doesn't mean it's impossible (or there couldn't be collisions, etc.), so plan accordingly.
You also might need a more sophisticated session management system than PHP's built-in handlers. I don't know if you can force PHP to continue a session across multiple visits (switching protocols is treated that way).
By default I would expect a browser to treat connections to http and https as completely different sessions. Although the convention is that http://someUrl/ and https://someUrl/ will point to the same page it isn't guaranteed. You could have completely different sites running on port 80 (http) and port 443 (https).
I don't know PHP, but generally I would not expect session variables to be freely available between secure and non-secure sessions e.g. I wouldn't expect the credit card number from my last checkout to be available to all the subsequent insecure pages I visit.
Forgive the non-authoritative answer but I thought I'd chuck in my 2c since there aren't many answers.