From 9e75d473525446d0961a7567bcb8a1e672949df8 Mon Sep 17 00:00:00 2001 From: cassiopc Date: Sat, 20 Oct 2012 14:24:23 +0200 Subject: fixed team login issue, included empty default options in submission tab, included extra-packages and links in ICPC Linux --- boca-1.5.1/src/fcontest.php | 2 +- boca-1.5.1/src/flog.php | 5 ++-- boca-1.5.1/src/scoretable.php | 55 +++++++++++++++++++++++-------------------- boca-1.5.1/src/team/run.php | 8 ++++++- 4 files changed, 41 insertions(+), 29 deletions(-) (limited to 'boca-1.5.1/src') diff --git a/boca-1.5.1/src/fcontest.php b/boca-1.5.1/src/fcontest.php index 23ce241..a698fd3 100644 --- a/boca-1.5.1/src/fcontest.php +++ b/boca-1.5.1/src/fcontest.php @@ -1205,7 +1205,7 @@ function DBNewUser($param, $c=null) { MSGError("Site $site does not exist"); return false; } - if($type=='team') $pass='!'.$pass; + if($type=='team' && $pass != myhash("")) $pass='!'.$pass; $sql = "insert into usertable (contestnumber, usersitenumber, usernumber, username, usericpcid, userfullname, " . "userdesc, usertype, userenabled, usermultilogin, userpassword, userpermitip) values " . "($contest, $site, $user, '$username', '$usericpcid', '$userfull', '$userdesc', '$type', '$enabled', " . diff --git a/boca-1.5.1/src/flog.php b/boca-1.5.1/src/flog.php index 56fdfed..e52e167 100644 --- a/boca-1.5.1/src/flog.php +++ b/boca-1.5.1/src/flog.php @@ -123,7 +123,7 @@ function DBLogInContest($name,$pass,$contest,$msg=true) { } $a = DBGetRow("select * from usertable where username='$name' and contestnumber=". $b["contestnumber"]." and " . - "usersitenumber=".$b["contestlocalsite"], 0, null, "DBLogIn(get user)"); + "usersitenumber=".$b["contestlocalsite"], 0, null, "DBLogIn(get user)"); if ($a == null) { if($msg) { LOGLevel("User $name tried to log in contest $contest but it does not exist.",2); @@ -131,12 +131,13 @@ function DBLogInContest($name,$pass,$contest,$msg=true) { } return false; } + $a = DBUserInfo($b["contestnumber"], $b["contestlocalsite"],$a['usernumber'],null,false); $_SESSION['usertable'] = $a; $p = myhash($a["userpassword"] . session_id()); $_SESSION['usertable']['userpassword'] = $p; if ($a["userpassword"] != "" && $p != $pass) { LOGLevel("User $name tried to log in contest $contest but password was incorrect.",2); - if($msg) MSGError("User does not exist or incorrect password."); + if($msg) MSGError("Incorrect password."); unset($_SESSION["usertable"]); return false; } diff --git a/boca-1.5.1/src/scoretable.php b/boca-1.5.1/src/scoretable.php index 0233e99..574b700 100644 --- a/boca-1.5.1/src/scoretable.php +++ b/boca-1.5.1/src/scoretable.php @@ -74,7 +74,7 @@ if(!ValidSession()) { $loc = $_SESSION["loc"]; if(!isset($detail)) $detail=true; if(!isset($final)) $final=false; -$scoredelay["admin"] = 1; +$scoredelay["admin"] = 2; $scoredelay["score"] = 30; $scoredelay["team"] = 30; $scoredelay["judge"] = 10; @@ -95,33 +95,38 @@ if(file_exists($scoretmp)) { } } +if($_SESSION["usertable"]["usertype"]=='score' || (isset($_GET["remote"]) && is_numeric($_GET["remote"]))) { + $remotedir = $_SESSION['locr'] . $ds . "private" . $ds . "remotescores"; + $destination = $remotedir . $ds ."scores.zip"; + if(is_writable($remotedir)) { + if($redo || !is_readable($destination)) { + if (($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null) + ForceLoad("index.php"); + + $level=$s["sitescorelevel"]; + $data0 = array(); + if($level>0) { + list($score,$data0) = DBScoreSite($_SESSION["usertable"]["contestnumber"], + $_SESSION["usertable"]["usersitenumber"], 1, -1); + } + $ct=DBGetActiveContest(); + $localsite=$ct['contestlocalsite']; + $fname = $remotedir . $ds . "score_site" . $localsite . "_" . md5($_SERVER['HTTP_HOST']); + @file_put_contents($fname . ".tmp",base64_encode(serialize($data0))); + @rename($fname . ".tmp",$fname . ".dat"); + + if(@create_zip($remotedir,glob($remotedir . '/*.dat'),$destination)!==true) { + LOGError("Cannot create score zip file"); + } else { + @create_zip($remotedir,array(),$destination); + } + } + } +} + if(isset($_GET["remote"])) { if(is_numeric($_GET["remote"])) { if($_GET["remote"]==-42) { - $remotedir = $_SESSION['locr'] . $ds . "private" . $ds . "remotescores"; - $destination = $remotedir . $ds ."scores.zip"; - if($redo || !is_readable($destination)) { - if (($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null) - ForceLoad("index.php"); - - $level=$s["sitescorelevel"]; - $data0 = array(); - if($level>0) { - list($score,$data0) = DBScoreSite($_SESSION["usertable"]["contestnumber"], - $_SESSION["usertable"]["usersitenumber"], 1, -1); - } - $ct=DBGetActiveContest(); - $localsite=$ct['contestlocalsite']; - $fname = $remotedir . $ds . "score_site" . $localsite . "_" . md5($_SERVER['HTTP_HOST']); - file_put_contents($fname . ".tmp",base64_encode(serialize($data0))); - rename($fname . ".tmp",$fname . ".dat"); - - if(create_zip($remotedir,glob($remotedir . '/*.dat'),$destination)!==true) { - LOGError("Cannot create score zip file"); - } else { - create_zip($remotedir,array(),$destination); - } - } echo file_get_contents($destination); } else { if (($s = DBSiteInfo($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"])) == null) diff --git a/boca-1.5.1/src/team/run.php b/boca-1.5.1/src/team/run.php index 51afc75..3879674 100644 --- a/boca-1.5.1/src/team/run.php +++ b/boca-1.5.1/src/team/run.php @@ -132,6 +132,7 @@ $strtmp .= "

To submit a program, just fill in the following f " \n". " \n". @@ -142,6 +143,7 @@ $strtmp .= " \n". " \n". " \n". @@ -157,8 +159,12 @@ $strtmp .= " \n". "
\n". " \n". -- cgit v1.2.3