Пример #1
0
	';
    $data .= '
                <script type="text/javascript">
                        window.setTimeout(function() {
                                location.reload();
                        }, 60000);
                </script>
        ';
} elseif ($page == "detail") {
    $metric = $_GET['metric'];
    $data = getPeriodHeader("GenomeDK Slurm " . $metric . " Overview");
    $data .= '
		<div class="container">
	';
    foreach ($periods as $period) {
        $data .= getGraph($period, $metric, 1, 'graph.php?r=' . $period . '&z=xxlarge&g=' . $metric);
    }
    $data .= '
		</div>
	';
} else {
    $data = "Unknown page";
}
?>
<!doctype html>
<html>
<head>
	<style type="text/css">
		.center {
			text-align: center;
		}
Пример #2
0
            $streak++;
        } else {
            $streak--;
        }
    }
    if ($date_arr[$pointer] != $date_arr[$pointer - 1] || $num < $cur + 1) {
        $fullStreak = 0;
        if (array_key_exists($dateday, $winDays)) {
            $fullStreak = $winDays[$dateday];
            $color = $graph_green;
        } else {
            if (array_key_exists($dateday, $loseDays)) {
                $fullStreak = $loseDays[$dateday];
                $color = $graph_red;
            } else {
                $color = $graph_grey;
            }
        }
        $out[$pointer] = array($streak, $color, $fullStreak);
        $pointer++;
        $streak = 0;
    }
    $cur++;
}
$imageurl = "grid.png";
$img = getGraph($out, $height, $width, $imageurl);
Header("Content-type: image/png");
$exp = GMDate("D, d M Y H:i:s", time() + 60 * 60 * 2);
Header("Expires: {$exp} GMT");
// Output Image data
imagepng($img);
Пример #3
0
         echo "invalid parameter";
         exit;
     }
     # Receive submission of user solution, verify and record best solution
 } else {
     if ($_GET['cmd'] == 'submit') {
         if (isset($_SESSION['visittime'])) {
             $time = time() - $_SESSION['visittime'];
             session_destroy();
         } else {
             $time = 2147483647;
             // MAX_INTEGER
         }
         if (isset($_GET['graph_id']) && isset($_GET['solution'])) {
             $X = $_GET['graph_id'];
             $graph = getGraph($X);
             $selectedEdges = json_decode($_GET['solution'], true);
             if (isValid($selectedEdges, $graph)) {
                 $user_score = calculateScore($selectedEdges, $graph);
                 global $db;
                 $query = "SELECT num_match, match_score, time FROM record WHERE graph_id = " . $X . ";";
                 $res = $db->query($query);
                 if (!$res) {
                     exit("There is a MySQL error, exiting this script");
                 }
                 $best = mysqli_fetch_row($res);
                 $isNewBest = count($selectedEdges) >= $best[0] && $user_score >= $best[1] ? 1 : 0;
                 $isNewHighScore = count($selectedEdges) >= $best[0] && $user_score > $best[1] || count($selectedEdges) == $best[0] && $user_score == $best[1] && $time <= $best[2] ? 1 : 0;
                 if ($isNewHighScore == 1) {
                     $query = "UPDATE record SET num_match = " . count($selectedEdges) . ", match_score = " . $user_score . ", time = " . $time . " WHERE graph_id = " . $X . ";";
                     $res = $db->query($query);