Add some checks on directories
This commit is contained in:
parent
b6792f3b72
commit
861b644b9e
7 changed files with 83 additions and 40 deletions
|
|
@ -4,19 +4,38 @@ if(!defined('ONYX')) exit;
|
|||
|
||||
$solved = count($EXERCICE->get_solved());
|
||||
|
||||
if ($n == 5 && $p[4] == "submission")
|
||||
if ($n >= 5 && $p[4] == "submission")
|
||||
{
|
||||
$template->assign("ERRcolor", "success");
|
||||
$template->assign("ERRmessage", "Votre réponse a bien été prise en compte et sera évaluée dans quelques instants...");
|
||||
if ($n >= 6 && $p[5] == "werr")
|
||||
{
|
||||
$template->assign("ERRcolor", "danger");
|
||||
if (DEBUG)
|
||||
$template->assign("ERRmessage", "DEBUG ERROR: le répertoire submission n'est pas accessible en écriture.");
|
||||
else
|
||||
$template->assign("ERRmessage", "Une erreur s'est produite durant la soumission. Veuillez réessayer dans quelques instants.");
|
||||
}
|
||||
else
|
||||
{
|
||||
$template->assign("ERRcolor", "success");
|
||||
$template->assign("ERRmessage", "Votre réponse a bien été prise en compte et sera évaluée dans quelques instants...");
|
||||
}
|
||||
|
||||
if (!empty($_POST["solution"]))
|
||||
{
|
||||
$file = ONYX . "../submission/".$p[1]."-".$p[2]."-".$p[3];
|
||||
if (is_writable(ONYX . "../submission/"))
|
||||
{
|
||||
$file = ONYX . "../submission/".$p[1]."-".$p[2]."-".$p[3];
|
||||
|
||||
file_put_contents($file, $_POST['solution'], LOCK_EX);
|
||||
file_put_contents($file, $_POST['solution'], LOCK_EX);
|
||||
|
||||
header("Location: /".implode("/", $p));
|
||||
exit;
|
||||
header("Location: /".implode("/", $p));
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
header("Location: /".implode("/", $p)."/werr");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Reference in a new issue