From be2491b093b1f0ca430bede679ecbb670041e483 Mon Sep 17 00:00:00 2001 From: cassio Date: Tue, 2 Jul 2013 09:46:45 +0400 Subject: restructuring of boca's git --- src/admin/contest.php | 256 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 256 insertions(+) create mode 100644 src/admin/contest.php (limited to 'src/admin/contest.php') diff --git a/src/admin/contest.php b/src/admin/contest.php new file mode 100644 index 0000000..ddffed4 --- /dev/null +++ b/src/admin/contest.php @@ -0,0 +1,256 @@ +. +//////////////////////////////////////////////////////////////////////////////// +// Last modified 21/jul/2012 by cassio@ime.usp.br +require 'header.php'; + +$contest=$_SESSION["usertable"]["contestnumber"]; + +if(($ct = DBContestInfo($contest)) == null) + ForceLoad("$loc/index.php"); +if ($ct["contestlocalsite"]==$ct["contestmainsite"]) $main=true; else $main=false; + +if (isset($_POST["Submit3"]) && isset($_POST["penalty"]) && is_numeric($_POST["penalty"]) && + isset($_POST["maxfilesize"]) && isset($_POST["mainsite"]) && isset($_POST["name"]) && + $_POST["name"] != "" && isset($_POST["lastmileanswer"]) && is_numeric($_POST["lastmileanswer"]) && + is_numeric($_POST["mainsite"]) && isset($_POST["lastmilescore"]) && is_numeric($_POST["lastmilescore"]) && + isset($_POST["duration"]) && is_numeric($_POST["duration"]) && isset($_POST['localsite']) && + isset($_POST["startdateh"]) && $_POST["startdateh"] >= 0 && $_POST["startdateh"] <= 23 && + isset($_POST["startdatemin"]) && $_POST["startdatemin"] >= 0 && $_POST["startdatemin"] <= 59 && + isset($_POST["startdated"]) && isset($_POST["startdatem"]) && isset($_POST["startdatey"]) && + checkdate($_POST["startdatem"], $_POST["startdated"], $_POST["startdatey"])) { + if ($_POST["confirmation"] == "confirm") { + $param['number']=$contest; + if($_POST["Submit3"] == "Become Main Site") { + $param['mainsite']=$ct["contestlocalsite"]; + } else { + $at = false; + if(!is_numeric($_POST['localsite']) || $_POST['localsite']<=0) $_POST['localsite']=-1; + if($_POST["Submit3"] == "Update Contest and All Sites") $at = true; + $t = mktime ($_POST["startdateh"], $_POST["startdatemin"], 0, + $_POST["startdatem"], $_POST["startdated"], $_POST["startdatey"]); + $param['localsite']=$_POST['localsite']; + $param['name']=$_POST["name"]; + $param['startdate']=$t; + $param['duration']=$_POST["duration"]*60; + $param['lastmileanswer']=$_POST["lastmileanswer"]*60; + $param['lastmilescore']= $_POST["lastmilescore"]*60; + $param['penalty']=$_POST["penalty"]*60; + $param['maxfilesize']=$_POST["maxfilesize"]*1000; + $param['active']=0; + $param['mainsite']=$_POST["mainsite"]; + $param['mainsiteurl']=$_POST["mainsiteurl"]; + $param['unlockkey']=$_POST["unlockkey"]; + + if (isset($_FILES["keyfile"]) && $_FILES["keyfile"]["name"]!="") { + $type=myhtmlspecialchars($_FILES["keyfile"]["type"]); + $size=myhtmlspecialchars($_FILES["keyfile"]["size"]); + $name=myhtmlspecialchars($_FILES["keyfile"]["name"]); + $temp=myhtmlspecialchars($_FILES["keyfile"]["tmp_name"]); + if (!is_uploaded_file($temp)) { + IntrusionNotify("file upload problem."); + ForceLoad("../index.php"); + } + if (($ar = file($temp)) === false) { + IntrusionNotify("Unable to open the uploaded file."); + ForceLoad("user.php"); + } + $dd=0; + foreach($ar as $val => $key) { + $key=trim($key); + if($key=='') { + unset($ar[$val]); + continue; + } + if(substr($key,10,5) != '#####') { + MSGError('Invalid key in the file -- not importing any keys'); + $dd=0; + break; + } + if(isset($param['unlockkey']) && $param['unlockkey'] != '') { + $pass=decryptData(substr($key,15),$param['unlockkey'],'includekeys'); + if(substr($pass,0,5) != '#####') { + MSGError('Invalid key in the file -- not importing any keys'); + $dd=0; + break; + } + } + $ar[$val]=$key; + $dd++; + } + if($dd > 0) { + $param['keys']=implode(',',$ar); + MSGError(count($ar) . ' keys are being imported from the file'); + DBClearProblemTmp($_SESSION["usertable"]["contestnumber"]); + } + } + $param['atualizasites']=$at; + } + DBUpdateContest ($param); + if(strlen($param['unlockkey'])>1) { + DBClearProblemTmp($_SESSION["usertable"]["contestnumber"]); + DBGetFullProblemData($_SESSION["usertable"]["contestnumber"],true); + } + } + ForceLoad("contest.php"); +} +?> +
+ +
+ + +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Contest number: + +
Name: + name="name" value="" size="50" maxlength="50" /> +
Start date: hh:mm + name="startdateh" value="" size="2" maxlength="2" /> + : + name="startdatemin" value="" size="2" maxlength="2" /> +     dd/mm/yyyy + name="startdated" value="" size="2" maxlength="2" /> + / + name="startdatem" value="" size="2" maxlength="2" /> + / + name="startdatey" value="" size="4" maxlength="4" /> +
Duration (in minutes): + value="" size="20" maxlength="20" /> +
Stop answering (in minutes): + value="" size="20" maxlength="20" /> +
Stop scoreboard (in minutes): + value="" size="20" maxlength="20" /> +
Penalty (in minutes): + value="" size="20" maxlength="20" /> +
Max file size allowed for teams (in KB): + + value="" size="20" maxlength="20" /> +
+ Your PHP config. allows at most: + +
+ +
Main site URL (IP/bocafolder): + " size="40" maxlength="200" /> +
Unlock password (only use it within a secure network): + + 1) echo "<= has been set"; ?> +
Keys (only use it within a secure network): + + 32) echo "<= has been set"; ?> +
Contest main site number: + value="" size="4" maxlength="4" /> +
Contest local site number: + value="" size="4" maxlength="4" /> +
+
+
+ + + + + + + + +
+
+ + + -- cgit v1.2.3