There is a list of events that are listed on a website. The date and time for the events are in UTC in the database. Whenever a user accesses the website we store his time offset in php session and then show him the time and date of the event in his timezone. There is a payment gateway to book the event and I am trying to send an email as soon as the payment is made. There are two ways I can do it.
When the user pays the amount, if the payment is successful, the payment gateway accesses my webhook with the data and then I update the database. Here after the payment data is received I can call my email function. But in the email I want to display the date and time according to the user timezone. So I want to know when the payment gateway hits my webhook with the data, will it be able to access the php session variables which were set when the user was accessing the website.
Another way is after the payment I send the user to another page and I check for confirmation of the payment. Once confirmed I can call an ajax function which sends the email to the user. Here I want to know, when I call the ajax function should I send the user time offset as data or the php function which gets executed when the ajax function is called will have access to the php sessions. My confusion is when an ajax function runs and the php page gets executed, does the php page get executed as a daemon script in the server.
TIA
The right answer it a simple yes. Your browser sends the cookies to the webserver like every other request. So your Session Cookie will be handled exact the same as a page reload.