Answer the question
In order to leave comments, you need to log in
Why does the session crash after submitting a form from another site?
Hello!
In general, there is a payment system, when you replenish the balance on the site.com site, on the payment system site you either cancel the payment or confirm it, and then the button to go to site.com appears.
In fact, a form with payment data is sent there.
So, when this form is sent to site.com, the session crashes, I can’t understand how this is possible.
I decided to submit from any random site, submit an empty form to site.com and the same thing happens.
I don't understand how this happens and why?
And how can this be corrected?
And I noticed this: the session identifier in the client's browser changes to a new one when the form is submitted, but physically the file with the old session exists on the disk, but for some reason a new identifier is created.
Perhaps this is due to the session start function.
Although it's still not clear.
It doesn't matter where I'm sending the form from, because the cookie hasn't changed, the browser should send the old session id when submitting the form.
function startSession()
{
session_set_cookie_params(0, '/', '.site.com');
if (isset($_COOKIE[session_name()]) AND preg_match('/^[-,a-zA-Z0-9]{1,128}$/', $_COOKIE[session_name()])) {
session_start();
} elseif (isset($_COOKIE[session_name()])) {
unset($_COOKIE[session_name()]);
session_start();
} else {
session_start();
}
}
Answer the question
In order to leave comments, you need to log in
Dmitry Tarasov ,
function startSession()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question