aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fcontest.php19
-rw-r--r--src/flog.php5
-rwxr-xr-xsrc/globals.php16
-rw-r--r--src/score/header.php11
-rw-r--r--src/scoretable.php8
-rw-r--r--src/staff/header.php1
-rw-r--r--src/team/run.php11
-rwxr-xr-xtools/boca-submit-run2
8 files changed, 44 insertions, 29 deletions
diff --git a/src/fcontest.php b/src/fcontest.php
index 7adbaab..0bbe94e 100644
--- a/src/fcontest.php
+++ b/src/fcontest.php
@@ -258,13 +258,13 @@ function DBUserInfo($contest, $site, $user, $c=null,$hashpass=true) {
}
if($hashpass)
$a['userpassword'] = myhash($a['userpassword'] . $a['usersessionextra']);
- $inst = explode(']',$a['userfullname']);
- if(isset($inst[1])) {
- $a['userfullname'] = trim($inst[1]);
- $inst = explode('[',$inst[0]);
- if(isset($inst[1]))
- $a['usershortname'] = trim($inst[1]);
- }
+ /* $inst = explode(']',$a['userfullname']); */
+ /* if(isset($inst[1])) { */
+ /* $a['userfullname'] = trim($inst[1]); */
+ /* $inst = explode('[',$inst[0]); */
+ /* if(isset($inst[1])) */
+ /* $a['usershortname'] = trim($inst[1]); */
+ /* } */
$inst = explode(']',$a['userdesc']);
if(isset($inst[1])) {
$inst2 = explode('[',$inst[0]);
@@ -1265,6 +1265,11 @@ function siteclock() {
if (($s=DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null)
ForceLoad("../index.php");
+ ///////CASO DE COMECAR MAIS TARDE NO CENTRALIZADO
+ if(substr($_SESSION["usertable"]["username"],0,3) == 'XXX') {
+ $s["currenttime"]=$s["currenttime"] - 60*10; // 10 minutos
+ }
+
if ($s["siteactive"]!="t")
return array("site is not active",-1000000000);
if (!$s["siterunning"])
diff --git a/src/flog.php b/src/flog.php
index 5eea441..5aef8e0 100644
--- a/src/flog.php
+++ b/src/flog.php
@@ -133,6 +133,9 @@ function DBLogInContest($name,$pass,$contest,$msg=true) {
}
$a = DBUserInfo($b["contestnumber"], $b["contestlocalsite"],$a['usernumber'],null,false);
$_SESSION['usertable'] = $a;
+ $_SESSION['usertable']['usersession']='';
+ $_SESSION['usertable']['userip']='';
+
$p = myhash($a["userpassword"] . session_id());
$_SESSION['usertable']['userpassword'] = $p;
if ($a["userpassword"] != "" && $p != $pass) {
@@ -175,6 +178,8 @@ function DBLogInContest($name,$pass,$contest,$msg=true) {
}
}
}
+ $_SESSION['usertable']['usersession']=session_id();
+ $_SESSION['usertable']['userip']=$gip;
$c = DBConnect();
$t = time();
if($a["usertype"] == "team" && $a["usermultilogin"] != "t" && $a["userpermitip"] == "") {
diff --git a/src/globals.php b/src/globals.php
index 5ece1e8..d87db56 100755
--- a/src/globals.php
+++ b/src/globals.php
@@ -205,13 +205,15 @@ function IntrusionNotify($where) {
// verifica se a sessao esta aberta e ok
function ValidSession() {
if (!isset($_SESSION["usertable"])) return(FALSE);
- if ($_SESSION["usertable"]["usersession"] == session_id() || $_SESSION["usertable"]["usersessionextra"] == session_id()) return(TRUE);
- if(($_SESSION["usertable"]["userip"] == getIP() && $_SESSION["usertable"]["usermultilogin"] == 't') ||
- $_SESSION["usertable"]["usertype"] == 'score') return(TRUE);
- $_SESSION["usertable"] = DBUserInfo($_SESSION["usertable"]["contestnumber"],
- $_SESSION["usertable"]["usersitenumber"],
- $_SESSION["usertable"]["usernumber"]);
- if ($_SESSION["usertable"]["usersession"] != session_id() && $_SESSION["usertable"]["usersessionextra"] != session_id()) return(FALSE);
+ $gip = getIP();
+ if ($_SESSION["usertable"]["userip"] != $gip ||
+ $_SESSION["usertable"]["usersession"] != session_id()) return(FALSE);
+ if($_SESSION["usertable"]["usermultilogin"] == 't') return(TRUE);
+
+ $tmp = DBUserInfo($_SESSION["usertable"]["contestnumber"],
+ $_SESSION["usertable"]["usersitenumber"],
+ $_SESSION["usertable"]["usernumber"]);
+ if ($tmp["userip"] != $gip) return(FALSE);
return(TRUE);
}
// grava erro no arquivo de log
diff --git a/src/score/header.php b/src/score/header.php
index 662a1bf..de43ff0 100644
--- a/src/score/header.php
+++ b/src/score/header.php
@@ -34,16 +34,7 @@ echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n"
echo "<link rel=stylesheet href=\"../Css.php\" type=\"text/css\">\n";
echo "<meta http-equiv=\"refresh\" content=\"60\" />";
-$ret=1;
-if (!isset($_SESSION["usertable"])) $ret=0;
-else {
- $_SESSION["usertable"] = DBUserInfo($_SESSION["usertable"]["contestnumber"],
- $_SESSION["usertable"]["usersitenumber"], $_SESSION["usertable"]["usernumber"]);
- if ($_SESSION["usertable"]["usersession"] != session_id() && $_SESSION["usertable"]["usermultilogin"]!="t")
- $ret=0;
-}
-
-if($ret==0) {
+if(!ValidSession()) {
InvalidSession("score/index.php");
ForceLoad("../index.php");
}
diff --git a/src/scoretable.php b/src/scoretable.php
index 18c57ba..b2f5efb 100644
--- a/src/scoretable.php
+++ b/src/scoretable.php
@@ -78,10 +78,10 @@ $loc = $_SESSION["loc"];
if(!isset($detail)) $detail=true;
if(!isset($final)) $final=false;
$scoredelay["admin"] = 3;
-$scoredelay["score"] = 60;
-$scoredelay["team"] = 20;
-$scoredelay["judge"] = 10;
-$scoredelay["staff"] = 60;
+$scoredelay["score"] = 30;
+$scoredelay["team"] = 10;
+$scoredelay["judge"] = 5;
+$scoredelay["staff"] = 30;
$actualdelay = 60;
if(isset($scoredelay[$_SESSION["usertable"]["usertype"]])) $actualdelay = $scoredelay[$_SESSION["usertable"]["usertype"]];
$ds = DIRECTORY_SEPARATOR;
diff --git a/src/staff/header.php b/src/staff/header.php
index 27119a6..ca820bc 100644
--- a/src/staff/header.php
+++ b/src/staff/header.php
@@ -66,6 +66,7 @@ echo "<table border=0 width=\"100%\" align=center>\n";
echo " <tr>\n";
echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=task.php>Tasks ($nr)</a></td>\n";
echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=score.php>Score</a></td>\n";
+echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=run.php>Runs</a></td>\n";
echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=option.php>Options</a></td>\n";
echo " <td align=center width=\"20%\"><a class=menu style=\"font-weight:bold\" href=../index.php>Logout</a></td>\n";
echo " </tr>\n";
diff --git a/src/team/run.php b/src/team/run.php
index c7add5d..6313c2f 100644
--- a/src/team/run.php
+++ b/src/team/run.php
@@ -149,6 +149,12 @@ if (isset($_POST["problem"]) && isset($_POST["language"]) &&
$dif = $b["currenttime"];
$param['rundatediff']=$dif - $pastval;
}
+
+ ///////CASO DE COMECAR MAIS TARDE NO CENTRALIZADO
+ if(substr($_SESSION["usertable"]["username"],0,3) == 'XXX') {
+ $param['rundate']=$param['rundate'] - 60*10; // 10 minutos
+ $param['rundatediff']=$param['rundatediff'] - 60*10;
+ }
$retv = DBNewRun ($param);
if($retv == 2) {
@file_put_contents($fcname, $verify . "\n", FILE_APPEND | LOCK_EX);
@@ -161,6 +167,11 @@ if (isset($_POST["problem"]) && isset($_POST["language"]) &&
}
exit;
}
+ ///////CASO DE COMECAR MAIS TARDE NO CENTRALIZADO
+ if(substr($_SESSION["usertable"]["username"],0,3) == 'XXX') {
+ $param['rundate']=$param['rundate'] - 60*10; // 10 minutos
+ $param['rundatediff']=$param['rundatediff'] - 60*10;
+ }
$retv = DBNewRun ($param);
if(isset($_POST['name']) && $_POST['name'] != '') {
if($retv == 2)
diff --git a/tools/boca-submit-run b/tools/boca-submit-run
index d67c83f..1502c07 100755
--- a/tools/boca-submit-run
+++ b/tools/boca-submit-run
@@ -71,5 +71,5 @@ if [ -r "$5" ]; then
[ -f "$temp" ] && rm -f $temp
done
else
- echo "file $1 not found/readable"
+ echo "file $5 not found/readable"
fi