diff --git a/admin/index.php b/admin/index.php index 2926007..6acebe1 100644 --- a/admin/index.php +++ b/admin/index.php @@ -14,6 +14,7 @@ else include('header.php'); connectdb(); + date_default_timezone_set('UTC'); ?>
  • Admin Panel
  • Users
  • @@ -43,13 +44,14 @@
    Name of event:
    - /> Accept submissions
    + Start Time in UTC (dd/mm/yy hh:mm:ss):
    + End Time in UTC (dd/mm/yy hh:mm:ss):

    Languages

    /> C
    /> C++
    diff --git a/admin/update.php b/admin/update.php index f1f42c5..a07c916 100644 --- a/admin/update.php +++ b/admin/update.php @@ -8,6 +8,7 @@ */ include('../functions.php'); connectdb(); + date_default_timezone_set('UTC'); if(isset($_POST['action'])){ if($_POST['action']=='email') { // update the admin email @@ -39,12 +40,15 @@ if(trim($_POST['name']) == "") header("Location: index.php?derror=1"); else { - if($_POST['accept']=='on') $accept=1; else $accept=0; + list($day, $month, $year, $hour, $minute) = split('[/ :]', $_POST['start']); + $start=mktime($hour, $minute,0, $month, $day, $year); + list($day, $month, $year, $hour, $minute) = split('[/ :]', $_POST['end']); + $end=mktime($hour, $minute,0, $month, $day, $year); if($_POST['c']=='on') $c=1; else $c=0; if($_POST['cpp']=='on') $cpp=1; else $cpp=0; if($_POST['java']=='on') $java=1; else $java=0; if($_POST['python']=='on') $python=1; else $python=0; - mysql_query("UPDATE prefs SET name='".mysql_real_escape_string($_POST['name'])."', accept=$accept, c=$c, cpp=$cpp, java=$java, python=$python"); + mysql_query("UPDATE prefs SET name='".mysql_real_escape_string($_POST['name'])."', start=$start, end=$end, c=$c, cpp=$cpp, java=$java, python=$python"); header("Location: index.php?changed=1"); } } else if($_POST['action']=='addproblem') { diff --git a/index.php b/index.php index ddbc4d9..e392d71 100644 --- a/index.php +++ b/index.php @@ -29,10 +29,16 @@ if(isset($_GET['success'])) echo("
    \nCongratulations! You have solved the problem successfully.\n
    "); ?> - Below is a list of available problems for you to solve.

    -
    "); if($status['status'] == 0) echo("
    \nYou have been banned. You cannot submit a solution.\n
    "); + if($accept['start']>time()) + header('location:index.php'); ?>

    Submit Solution

    "/>
    Type your program below:


    - "); + time() and $status['status'] == 1) echo(""); else echo(""); ?> You are allowed to use any of the following languages: