Location: PHPKode > projects > Fretsweb > fretsweb-1.2/fretsweb/admin/timer.php
<?php

/*
Fretsweb - A Frets on Fire chart server
Copyright (C) 2009, Daan Sprenkels

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

require_once "common.php";

//Login Test
session_start();
if($_SESSION['in'] < 1)
{
	header('location: login.php?need=moderator');
	die();
}

if(isset($_POST['submit']))
{
	include_once "status.php";
	$startdate = explode('-', $_POST['startdate']);
	$starttime = explode(':', $_POST['starttime']);
	$enddate = explode('-', $_POST['enddate']);
	$endtime = explode(':', $_POST['endtime']);
	$starttime = mktime($starttime[0]*1,$starttime[1]*1,$starttime[2]*1,$startdate[1]*1,$startdate[2]*1,$startdate[0]*1);
	$endtime = mktime($endtime[0]*1,$endtime[1]*1,$endtime[2]*1,$enddate[1]*1,$enddate[2]*1,$enddate[0]*1);
	set_contest_status($starttime , $endtime);
	header('location: index.php');
	cfeed('Contest timer', "A contest timer is set:\nThe contest will be opened o n{$_POST['startdate']} at {$_POST['starttime']}. The contest will be closed again on {$_POST['enddate']} at {$_POST['endtime']}.", 'configchange');
	mysql_close($db_link);
	die();
}

?>
<html>
 <head>
  <title>Open/close timer</title>
  <link href="../css.php" rel="stylesheet" type="text/css" />
  <link href="../images/favicon.png" rel="icon">
 </head>
 <body>
  <center>
   <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post">
    <h2>Open/close timer</h2>
    <?php echo $err; ?>
    <p>Please enter the start and end time in the 
    <input type="text" name="testdate" maxlength="10" size="10" value="<? echo date('Y-n-d'); ?>" disabled>
    <input type="text" name="testtime" maxlength="8" size="8" value="<? echo date('H:i:s'); ?>" disabled>
     format.
    </p>
    <p>
    Start time:
    <input type="text" name="startdate" maxlength="10" size="10">
    <input type="text" name="starttime" maxlength="8" size="8">
    </p>
    <p>
    End time:
    <input type="text" name="enddate" maxlength="10" size="10">
    <input type="text" name="endtime" maxlength="8" size="8">
    </p>
    <p>
    <input type="submit" name="submit" value="Submit">
    </p>
   </form>
   <p><b><a href="index.php">Back to main administration panel</a></b><p>
  </center>
 </body>
</html>
Return current item: Fretsweb