hbarg/index.php

57 lines
1.2 KiB
PHP

<?php
function haveLocation() {
$arc_exists = isset($_GET["arc"]);
$bump_exists = isset($_GET["bump"]);
$both_exist = $arc_exists && $bump_exists;
if ($both_exist) {
return 2;
}
if ($arc_exists) {
return 1;
}
return 0;
}
function get_bump_number($a, $b) {
$arc_counts = [15,8,2];
$a = $a-1;
$b = $b*1;
if (($a==-1) || ($b==-1) || ($a>=count($arc_counts)) || ($b>$arc_counts[$a])) {
return "invalid";
}
for ($i=0;$i<$a;$i++) {
$b = $b + $arc_counts[$i];
}
return $b;
}
$arc_san = htmlspecialchars($_GET["arc"]??'');
$bump_san = htmlspecialchars($_GET["bump"]??'');
$bumpn = (haveLocation()==2) ? get_bump_number($arc_san,$bump_san) : 'invalid';
$arc_names = array("1"=>"LIL_HEAD","2"=>"Find Amelia","3"=>"Experiment G-15.2");
$arc_name = $arc_names[$arc_san] ?? "Invalid";
if (haveLocation()==2) {
$title = "Arc {$arc_san}, Bump {$bump_san}";
$desc = "Bump {$bump_san} of arc {$arc_san}";
}
if (haveLocation()==1) {
$title = "Arc {$arc_san}";
$desc = "Info and bumps for Arc {$arc_san} [{$arc_name}]";
}
include 'header.php';
if (haveLocation()==0) {
include 'main.php';
}
if (haveLocation()==1) {
include 'arc.php';
}
if (haveLocation()==2) {
include 'bump.php';
}
include 'footer.php';
?>