0

I have the following php scripts which creates a random string of characters as "Token" and it's then stored in a session called "ajaxToken". What I would like to do is to add more security by expiring this session after some time and enforce it to generate a new one. Is there a way of doing it that? Note: I have the session_start(); in another php page.

<?php
  $token = substr(str_shuffle(MD5(microtime())),0,20);
  $_SESSION["ajaxToken"] = $token;
?>
Cosmin Staicu
  • 1,809
  • 2
  • 20
  • 27
  • Hi @user15798376 - does this help other very similar question help - https://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes ? – Mr R Apr 30 '21 at 04:58
  • Does this answer your question? [How do I expire a PHP session after 30 minutes?](https://stackoverflow.com/questions/520237/how-do-i-expire-a-php-session-after-30-minutes) – SphynxTech Apr 30 '21 at 11:11

0 Answers0