aboutsummaryrefslogtreecommitdiff
path: root/boca-1.5.0/src/admin
diff options
context:
space:
mode:
Diffstat (limited to 'boca-1.5.0/src/admin')
-rw-r--r--boca-1.5.0/src/admin/problem.php20
-rw-r--r--boca-1.5.0/src/admin/report/piechart.php10
-rw-r--r--boca-1.5.0/src/admin/report/stat.php12
-rw-r--r--boca-1.5.0/src/admin/task.php2
-rw-r--r--boca-1.5.0/src/admin/user.php44
5 files changed, 66 insertions, 22 deletions
diff --git a/boca-1.5.0/src/admin/problem.php b/boca-1.5.0/src/admin/problem.php
index 0b055b6..365d059 100644
--- a/boca-1.5.0/src/admin/problem.php
+++ b/boca-1.5.0/src/admin/problem.php
@@ -61,7 +61,7 @@ if (isset($_POST["Submit3"]) && isset($_POST["problemnumber"]) && is_numeric($_P
<br>
<script language="javascript">
function conf2(url) {
- if (confirm("Confirm the DELETION of the PROBLEM and ALL data associated to it (including the SUBMISSIONS)?")) {
+ if (confirm("Confirm the DELETION of the PROBLEM and ALL data associated to it?")) {
if (confirm("Are you REALLY sure about what you are doing? DATA CANNOT BE RECOVERED!")) {
document.location=url;
} else {
@@ -71,6 +71,13 @@ if (isset($_POST["Submit3"]) && isset($_POST["problemnumber"]) && is_numeric($_P
document.location='problem.php';
}
}
+ function conf3(url) {
+ if (confirm("Confirm the UNDELETION of the PROBLEM?")) {
+ document.location=url;
+ } else {
+ document.location='problem.php';
+ }
+ }
</script>
<table width="100%" border=1>
<tr>
@@ -89,8 +96,15 @@ if (isset($_POST["Submit3"]) && isset($_POST["problemnumber"]) && is_numeric($_P
for ($i=0; $i<count($prob); $i++) {
echo " <tr>\n";
if($prob[$i]["fake"]!='t') {
- echo " <td nowrap><a href=\"javascript: conf2('problem.php?delete=" . $prob[$i]["number"] . "&input=" . rawurlencode($prob[$i]["inputfilename"]) .
- "')\">" . $prob[$i]["number"] . "</a></td>\n";
+ if(strpos($prob[$i]["fullname"],"(DEL)") !== false) {
+ echo " <td nowrap><a href=\"javascript: conf3('problem.php?delete=" . $prob[$i]["number"] . "&input=" . rawurlencode($prob[$i]["inputfilename"]) .
+ "')\">" . $prob[$i]["number"];
+ echo "(deleted)";
+ } else {
+ echo " <td nowrap><a href=\"javascript: conf2('problem.php?delete=" . $prob[$i]["number"] . "&input=" . rawurlencode($prob[$i]["inputfilename"]) .
+ "')\">" . $prob[$i]["number"];
+ }
+ echo "</a></td>\n";
} else {
echo " <td nowrap>" . $prob[$i]["number"] . " (fake)</td>\n";
}
diff --git a/boca-1.5.0/src/admin/report/piechart.php b/boca-1.5.0/src/admin/report/piechart.php
index 18d8d04..e6dbf95 100644
--- a/boca-1.5.0/src/admin/report/piechart.php
+++ b/boca-1.5.0/src/admin/report/piechart.php
@@ -41,7 +41,12 @@ else
$chart = new PieChart(400, 250);
if(isset($_GET['order'])) $chart->order=true;
+else $chart->order=false;
+$tot=0;
+for($i=1;$i<count($v); $i+=2) {
+ $tot += $v[$i+1];
+}
for($i=1;$i<count($v); $i+=2) {
$color = null;
if($cor != null) {
@@ -50,7 +55,10 @@ for($i=1;$i<count($v); $i+=2) {
$b = hexdec( substr($cor[($i-1)/2], 4, 2) );
$color = array($r, $g, $b);
}
- $chart->addPoint(new Point($v[$i], $v[$i+1], $color));
+ if($v[$i+1] > $tot/100)
+ $chart->addPoint(new Point($v[$i], $v[$i+1], $color));
+ else
+ $chart->addPoint(new Point($v[$i], $tot/100, $color));
}
$chart->setTitle($v[0]);
diff --git a/boca-1.5.0/src/admin/report/stat.php b/boca-1.5.0/src/admin/report/stat.php
index 7d99cb3..1abfa71 100644
--- a/boca-1.5.0/src/admin/report/stat.php
+++ b/boca-1.5.0/src/admin/report/stat.php
@@ -233,7 +233,9 @@ echo "<td>Total</td><td>Accepted</td></tr>\n";
reset($d['username']);
while (list($keya, $vala) = each($d['username'])) {
$keya = $d['username'][$keya];
- $vala = $d['user'][$keya];
+ if(isset($d['user'][$keya]))
+ $vala = $d['user'][$keya];
+ else $vala=0;
echo "<tr><td>".$d['userfull'][$keya]."</td>";
reset($d['problem']);
while (list($key, $val) = each($d['problem'])) {
@@ -289,7 +291,9 @@ while (list($keya, $val) = each($d['timestamp'])) {
$atual += $passo;
$pos++;
}
- $res[$pos]++;
+ if(isset($res[$pos]))
+ $res[$pos]++;
+ else $res[$pos]=1;
if($res[$pos] > $m) $m=$res[$pos];
}
@@ -318,7 +322,9 @@ while (list($keya, $val) = each($d['timestampyes'])) {
$atual += $passo;
$pos++;
}
- $res[$pos]++;
+ if(isset($res[$pos]))
+ $res[$pos]++;
+ else $res[$pos]=1;
}
$str="Accepted Runs by Time Period" . chr(1) . $m;
diff --git a/boca-1.5.0/src/admin/task.php b/boca-1.5.0/src/admin/task.php
index 95aca10..a7a5339 100644
--- a/boca-1.5.0/src/admin/task.php
+++ b/boca-1.5.0/src/admin/task.php
@@ -101,7 +101,7 @@ for ($i=0; $i<count($task); $i++) {
}
echo "</td>\n";
if ($task[$i]["oid"] != null) {
- $msg = $task[$i]["username"]." ".$task[$i]["username"]." ".$task[$i]["username"]." ".
+ $msg = "///// " . $task[$i]["username"]." ".$task[$i]["username"]." ".$task[$i]["username"]." ".
$task[$i]["username"]." ".$task[$i]["username"]." ".$task[$i]["username"];
echo " <td nowrap><a href=\"../filedownload.php?" . filedownload($task[$i]["oid"], $task[$i]["filename"]) . "\">" . $task[$i]["filename"] . "</a>";
echo " <a href=\"#\" class=menu style=\"font-weight:bold\" onClick=\"window.open('../filewindow.php?".
diff --git a/boca-1.5.0/src/admin/user.php b/boca-1.5.0/src/admin/user.php
index 88cc148..5e07930 100644
--- a/boca-1.5.0/src/admin/user.php
+++ b/boca-1.5.0/src/admin/user.php
@@ -37,7 +37,7 @@ if($ct["contestlocalsite"]==$ct["contestmainsite"]) $main=true; else $main=false
if (isset($_POST["username"]) && isset($_POST["userfullname"]) && isset($_POST["userdesc"]) && isset($_POST["userip"]) &&
isset($_POST["usernumber"]) && isset($_POST["usersitenumber"]) && isset($_POST["userenabled"]) && isset($_POST["usericpcid"]) &&
isset($_POST["usermultilogin"]) && isset($_POST["usertype"]) && isset($_POST["confirmation"]) &&
- isset($_POST["passwordn1"]) && isset($_POST["passwordn2"]) && $_POST["confirmation"] == "confirm") {
+ isset($_POST["passwordn1"]) && isset($_POST["passwordn2"]) && isset($_POST["passwordo"]) && $_POST["confirmation"] == "confirm") {
$param['user'] = htmlspecialchars($_POST["usernumber"]);
$param['site'] = htmlspecialchars($_POST["usersitenumber"]);
$param['username'] = htmlspecialchars($_POST["username"]);
@@ -47,13 +47,20 @@ if (isset($_POST["username"]) && isset($_POST["userfullname"]) && isset($_POST["
$param['userfull'] = htmlspecialchars($_POST["userfullname"]);
$param['userdesc'] = htmlspecialchars($_POST["userdesc"]);
$param['type'] = htmlspecialchars($_POST["usertype"]);
- $param['pass'] = htmlspecialchars($_POST["passwordn1"]);
$param['permitip'] = htmlspecialchars($_POST["userip"]);
$param['contest'] = $_SESSION["usertable"]["contestnumber"];
- if ($_POST["passwordn1"] == $_POST["passwordn2"]) {
- DBNewUser($param);
+
+ $passcheck = htmlspecialchars($_POST["passwordo"]);
+ $a = DBUserInfo($_SESSION["usertable"]["contestnumber"], $_SESSION["usertable"]["usersitenumber"], $_SESSION["usertable"]["usernumber"], null, false);
+ if(myhash($a['userpassword'] . session_id()) != $passcheck) {
+ MSGError('Admin password is incorrect');
+ } else {
+ if ($_POST["passwordn1"] == $_POST["passwordn2"]) {
+ $param['pass'] = bighexsub(htmlspecialchars($_POST["passwordn1"]),$a['userpassword']);
+ DBNewUser($param);
+ }
+ else MSGError ("Passwords don't match.");
}
- else MSGError ("Passwords don't match.");
ForceLoad("user.php");
}
else if (isset($_FILES["importfile"]) && isset($_POST["Submit"]) && $_FILES["importfile"]["name"]!="") {
@@ -73,10 +80,10 @@ else if (isset($_FILES["importfile"]) && isset($_POST["Submit"]) && $_FILES["imp
}
$userlist=array();
if(strtolower(substr($name,-4))==".tsv") {
- for ($i=0; $i<count($ar) && strpos($ar[$i], "File_Version\t1") === false; $i++) ;
- if($i >= $count($ar)) MSGError('File format not recognized');
+ for ($i=0; $i < count($ar) && strpos($ar[$i], "File_Version\t1") === false; $i++) ;
+ if($i >= count($ar)) MSGError('File format not recognized');
$oklines=0;
- for ($i++; $i<count($ar); $i++) {
+ for ($i++; $i < count($ar); $i++) {
$x = explode("\t",trim($ar[$i]));
if(count($x)==7) {
$param['site']=trim($x[2]);
@@ -129,9 +136,9 @@ else if (isset($_FILES["importfile"]) && isset($_POST["Submit"]) && $_FILES["imp
}
MSGError($oklines . ' users included/updated successfully');
} else {
- for ($i=0; $i<count($ar) && strpos($ar[$i], "[user]") === false; $i++) ;
- if($i >= $count($ar)) MSGError('File format not recognized');
- for ($i++; $i<count($ar) && $ar[$i][0] != "["; $i++) {
+ for ($i=0; $i < count($ar) && strpos($ar[$i], "[user]") === false; $i++) ;
+ if($i >= count($ar)) MSGError('File format not recognized');
+ for ($i++; $i < count($ar) && $ar[$i][0] != "["; $i++) {
$x = trim($ar[$i]);
if (strpos($x, "user") !== false && strpos($x, "user") == 0) {
$param = array();
@@ -215,7 +222,7 @@ else
<td><b>Description</b></td>
</tr>
<?php
-for ($i=0; $i<count($usr); $i++) {
+for ($i=0; $i < count($usr); $i++) {
echo " <tr>\n";
if(($usr[$i]["usersitenumber"] == $_SESSION["usertable"]["usersitenumber"] || $main==true) &&
//$usr[$i]["usertype"] != 'site' &&
@@ -271,8 +278,11 @@ if (isset($_GET["site"]) && isset($_GET["user"]) && is_numeric($_GET["site"]) &&
<script language="JavaScript">
function computeHASH()
{
- document.form3.passwordn1.value = js_myhash(document.form3.passwordn1.value);
- document.form3.passwordn2.value = js_myhash(document.form3.passwordn2.value);
+ document.form3.passwordn1.value = bighexsoma(js_myhash(document.form3.passwordn1.value),js_myhash(document.form3.passwordo.value));
+ document.form3.passwordn2.value = bighexsoma(js_myhash(document.form3.passwordn2.value),js_myhash(document.form3.passwordo.value));
+ document.form3.passwordo.value = js_myhash(js_myhash(document.form3.passwordo.value)+'<?php echo session_id(); ?>');
+// document.form3.passwordn1.value = js_myhash(document.form3.passwordn1.value);
+// document.form3.passwordn2.value = js_myhash(document.form3.passwordn2.value);
}
</script>
@@ -426,6 +436,12 @@ if (isset($u)) {
<input type="password" name="passwordn2" value="" size="20" maxlength="200" />
</td>
</tr>
+ <tr>
+ <td width="35%" align=right>Admin (this user) Password:</td>
+ <td width="65%">
+ <input type="password" name="passwordo" value="" size="20" maxlength="200" />
+ </td>
+ </tr>
</table>
</center>
<center>