0
votes

In azure app service I am authenticating users using office365, once user logs in I am storing some data in $_SESSION variables. But the problem occurs when multiple users log in to the application.

For Example: User "A" has logged in to the application and I am storing user-data $_SESSION["username"] = "A" and redirecting to a page, and at the same time User "X" is logging into the application and the user-data $_SESSION["username"] = "X" is replacing the previous $_SESSION["username"] value i.e "A".

  1. In the php.ini session.save_handler => files; session.save_path => /home/site/wwwroot/tmp

  2. This application is hosted as Azure App Service[Linux] with Free ASP.

  3. And I am using PHP Version 7.2.20.
<?php
session_start();
//Codes to authenticate user and getting user details
$_SESSION["username"] = "John";
session_write_close();
header("Location: page1.php");
?>

here once a user named "Doe" is logging in. The Value in $_SESSION["username"] is getting replaced by "Doe";

1

1 Answers

0
votes
<?php
session_destroy();
?>

You must destory your session when the person is logged out.