Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

323
Visualizações
Does a php function which gets executed on Ajax call have access to the session variables?

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.

  1. 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.

  2. 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

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

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.

about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda