Working synchronization
This commit is contained in:
parent
db77d8b697
commit
3c04523ca8
6 changed files with 135 additions and 44 deletions
|
|
@ -5,20 +5,21 @@ function show($file)
|
|||
if (file_exists($file))
|
||||
print file_get_contents($file);
|
||||
else
|
||||
header("Location: ".$_SERVER["HTTP_REFERER"]);
|
||||
header("HTTP/1.1 403 Forbidden");
|
||||
}
|
||||
|
||||
$file = __DIR__."/submission/".intval($_GET["team"])."-".intval($_GET["theme"])."-".urlencode($_GET["exercice"]);
|
||||
|
||||
|
||||
if (file_exists($file))
|
||||
show(__DIR__."/teams/".intval($_GET["team"])."/submission-".intval($_GET["theme"])."-".urlencode($_GET["exercice"])."-already.html");
|
||||
show(__DIR__."/teams/".intval($_GET["team"])."/".urlencode($_GET["theme"])."/".urlencode($_GET["exercice"])."/submission/serr/index.html");
|
||||
|
||||
else if (!empty($_POST["solution"]) && !empty($_GET["team"]) && !empty($_GET["theme"]) && !empty($_GET["exercice"]))
|
||||
{
|
||||
file_put_contents($file, $_POST['solution'], LOCK_EX);
|
||||
|
||||
show(__DIR__."/teams/".intval($_GET["team"])."/submission-".intval($_GET["theme"])."-".urlencode($_GET["exercice"]).".html");
|
||||
show(__DIR__."/teams/".intval($_GET["team"])."/".urlencode($_GET["theme"])."/".urlencode($_GET["exercice"])."/submission/index.html");
|
||||
}
|
||||
|
||||
else
|
||||
show(__DIR__."/teams/".intval($_GET["team"])."/submission-".intval($_GET["theme"])."-".urlencode($_GET["exercice"])."-bad.html");
|
||||
show(__DIR__."/teams/".intval($_GET["team"])."/".urlencode($_GET["theme"])."/".urlencode($_GET["exercice"])."/submission/gerr/index.html");
|
||||
|
|
|
|||
Reference in a new issue