In PHP, we create sessions for the user who is logged in and make that user online till the user log out of that session. It can be done by clicking on the logout button or by destroying that session after a fixed time.
By default the expiry time of any particular session that is created is 1440 secs i.e. (24*60) i.e. 24 minutes. But in some cases, we need to change the default time accordingly.
We can do that in 2 ways.
1. We can change it in the php.ini file, and change the configuration, but that will change the default time for all the sites working on that server and that will be a hindrance to all other sites.So the second option is preferable.
2. We can logically change the destroy time of the session. We take the time of the creation of the session by calculating the system current time and as the user browses to different pages of the script will check for the expiry time i.e. is explicitly declared as session-expiry.
index.php: If you enter wrong credentials it will throw an error, If you enter correct credentials you will be redirected to “HomePage.php” and destroy session after 1 minute.The developer can change the time accordingly.
Please Login to comment...