在预定时间过后,php过期页面

I want to create a simple PHP application, through which students can submit their projects. I wish to set a timer (say in hours or even days), which when elapsed, the system automatically submits all the projects and disables the submit form.

Any idea of how I can set the timer and take action on page expire?

I would do something like this (PHP part):

<?php 
$till = mktime(...);
if (time() < $till) {
  if (isset($_POST['..'])) {
    // submit form
  } else {
    // show form
  }
} else {
  echo "Time's up";
}
?>

To submit all forms, i would do with the cronjob.