<?php include "functions.php"; html_start("home"); if (isset($_POST["logout"])) { $_SESSION["authorised"] = false; } if (isset($_POST["login"])) { if ($_POST["password"] == $password) { $_SESSION["authorised"] = sha1($_POST["password"]); } else { alertMsg("danger", "Incorrect password!"); } } if (authorised(false)) { ?> <h4 class="heading">Welcome</h4> <p>You can now proceed to <a href="submit.php">submit new task</a>, or to <a href="results.php">view results</a> of your previous tasks.</p> <br /> <form method="post" action="index.php"> <button type="submit" name="logout" type="button" class="btn btn-danger">Log out</button> </form> <?php } else { ?> <h4 class="heading">Log in</h4> <form class="form-horizontal" method="post" action="index.php"> <fieldset> <div class="form-group"> <label for="password" class="col-lg-2 col-xs-2 control-label">Password:</label> <div class="col-lg-4 col-xs-6">
<?php include "functions.php"; html_start("results"); if (authorised()) { ?> <a href="#" class="scroll-down"><span class="glyphicon glyphicon-chevron-down"></span></a> <h4 class="heading">Task status</h4> <?php if (!isset($_GET["task"]) || !file_exists($tasksDir . "/" . $_GET["task"])) { alertMsg("danger", "Invalid task ID!"); } else { $dir = $tasksDir . "/" . $_GET["task"]; $infoFile = fopen("{$dir}/inputInfo.txt", "r"); $taskName = fgets($infoFile); $startTime = fgets($infoFile); fgets($infoFile); // Skip task directory $inputFile = fgets($infoFile); fclose($infoFile); echo "<p><b>Task name:</b> {$taskName}</p>\n"; echo "<p><b>Submit time:</b> {$startTime}</p>\n"; echo "<p><b>Input file:</b> {$inputFile}</p><br />\n"; echo "<p><b>Status:</b></p>\n"; echo "<pre>\n"; $statusFilePath = "{$dir}/sysout.txt"; if (!file_exists($statusFilePath)) { echo "Error: status file not found."; } else { $statusFile = fopen($statusFilePath, "r"); while (!feof($statusFile)) {