diff options
| author | cassio <cassiopc@gmail.com> | 2015-08-10 04:47:50 +0000 |
|---|---|---|
| committer | cassio <cassiopc@gmail.com> | 2015-08-10 04:47:50 +0000 |
| commit | 0c84724c228874c524ba9ca5a00b6ec91c8e2c3f (patch) | |
| tree | a108c346a46e329979fb156d902449ba37d2f532 | |
| parent | e9a96f5453e5675bfcc74c3c977720064575c423 (diff) | |
| download | boca-0c84724c228874c524ba9ca5a00b6ec91c8e2c3f.tar.gz boca-0c84724c228874c524ba9ca5a00b6ec91c8e2c3f.zip | |
fixes
| -rw-r--r-- | src/team/run.php | 3 | ||||
| -rwxr-xr-x | tools/boca-submit-run-aux | 1 | ||||
| -rw-r--r-- | tools/boca-submit-run-cron | 5 | ||||
| -rw-r--r-- | tools/boca-submit-run-root | 11 |
4 files changed, 14 insertions, 6 deletions
diff --git a/src/team/run.php b/src/team/run.php index 13cf2fd..db142f4 100644 --- a/src/team/run.php +++ b/src/team/run.php @@ -83,7 +83,8 @@ if (isset($_FILES["sourcefile"]) && isset($_POST["problem"]) && isset($_POST["Su if(isset($_POST["pasthash"]) && isset($_POST["pastval"])) { $pasthash = myhtmlspecialchars($_POST["pasthash"]); $pastval = myhtmlspecialchars($_POST["pastval"]); - $pastsubmission = myhash(@file_get_contents($_SESSION["locr"] . $ds . "private" . $ds . 'run-past.config') . $pastcode); + $pastabs = myhtmlspecialchars($_POST["pastabs"]); + $pastsubmission = myhash(@file_get_contents($_SESSION["locr"] . $ds . "private" . $ds . 'run-past.config') . $pastcode . $pastabs); if($pastsubmission != $pasthash) { echo "\nRESULT: INVALID SUBMISSION CODE"; exit; diff --git a/tools/boca-submit-run-aux b/tools/boca-submit-run-aux index 330c3df..1469af3 100755 --- a/tools/boca-submit-run-aux +++ b/tools/boca-submit-run-aux @@ -37,6 +37,7 @@ if [ "$?" == "0" ]; then if [ "$code" != "" ]; then echo -n "&pasthash=$code" >> $temp if [ "$dateerr" != "" ]; then + echo -n "&pastabs=${dateerr}" let "dateerr = `date +%s` - $dateerr" echo -n "&pastval=${dateerr}" fi diff --git a/tools/boca-submit-run-cron b/tools/boca-submit-run-cron new file mode 100644 index 0000000..c77b4d5 --- /dev/null +++ b/tools/boca-submit-run-cron @@ -0,0 +1,5 @@ +#!/bin/bash + +for i in `ls /root/submissions/*.bocarun`; do + boca-submit-run-aux "$i" +done diff --git a/tools/boca-submit-run-root b/tools/boca-submit-run-root index a72d1db..21ecbc6 100644 --- a/tools/boca-submit-run-root +++ b/tools/boca-submit-run-root @@ -4,12 +4,13 @@ if [ "$1" != "" ]; then mkdir -p /root/submissions chown root /root/submissions chmod 700 /root/submissions - cp "$1" /root/submissions - echo "dateerr=`date +%s`" >> "/root/submissions/$1" + nom=/root/submissions/`date +%s%N`.bocarun + cp "$1" "$nom" + echo "dateerr=`date +%s`" >> "$nom" uniq=`date +%sN`-`sha256sum "$1"` uniq=`echo $uniq | sha256sum - | cut -f1 -d' '` code=`cat /root/submissions/code` - res=`echo -n "${code}${uniq}" | sha256sum - | cut -f1 -d' '` - echo "uniq=$uniq" >> "/root/submissions/$1" - echo "code=$res" >> "/root/submissions/$1" + res=`echo -n "${code}${uniq}${dateerr}" | sha256sum - | cut -f1 -d' '` + echo "uniq=$uniq" >> "$nom" + echo "code=$res" >> "$nom" fi |