they could sit at the form for hours, and this will not do anything until they submit the form.
to implement this, you must set the time_start at the same time you deliver the form to them.
once they submit the form back to you, then you check if they took too long.
// display_form.php
session_start();
if (!isset($_SESSION['time_start'])) {
$_SESSION['time_start'] = time();
}
echo "<form>blah.......";
// receive_form.php
$allowed_secs = 300;
session_start();
if ((time() - $_SESSION['time_start']) > $allowed_secs) {
echo 'you took too long.';
// redirect, or die(), or whatever you wanna do
} else {
// accept form
}
if you want something to notify them thier time is up as soon as that happens, you need to use javascript for that. you could google for "javascript timer" and prob find something usefull. but remember if javascript is disabled, it wont work, so it might be better to use php.