1session_destroy(); // To delete whole session
2// OR
3unset($_SESSION['myVar']); // To delete a session var
1<?php
2 session_start(); // start session
3 session_destroy(); // Delete whole session
4// OR
5unset($_SESSION['username']); // delete any specific session only
6?>
1// Create a session variable called something like this after you start the session:
2$_SESSION['user_start'] = time();
3
4// Then when they get to submitting the payment, just check whether they're within the 5 minute window
5if (time() - $_SESSION['user_start'] < 300) { // 300 seconds = 5 minutes
6 // they're within the 5 minutes so save the details to the database
7} else {
8 // sorry, you're out of time
9 unset($_SESSION['user_start']); // and unset any other session vars for this task
10}
1<?php
2session_start();
3
4// 2 hours in seconds
5$inactive = 7200;
6
7$session_life = time() - $_session['testing'];
8
9if($session_life > $inactive)
10{
11 session_destroy();
12}
13
14$_session['testing']=time();
15
16 echo $_SESSION['testing']; //prints NOTHING?
17 ?>