</body>

<footer>
  <?php
function get_args_from_url()
{
    $args = [];
    $arr = explode('&', $_SERVER['QUERY_STRING']);

    foreach ($arr as $a) {
        $tmp = explode('=', $a);
        $key = $tmp[0];
        $value = $tmp[1];

        $args[$key] = $value;
    }

    return $args;
}

if ($_SERVER['SCRIPT_NAME'] == '/user.php') {
    $args = get_args_from_url();

    if (isset($args['action'])) {
        if ($args['action'] == 'signup') {
            echo '
  <script src="js/profile_picture_cropper_modal.js"></script>
  <script src="js/upload.js"></script>
        ';
        } else if ($args['action'] == 'view') {
            echo '
  <script src="js/user_actions_modal.js"></script>
  <script src="js/profile_picture_cropper_modal.js"></script>
  <script src="js/upload.js"></script>
            ';
        }
    }
} else if ($_SERVER['SCRIPT_NAME'] == '/admin.php') {
    echo '
  <script src="js/clickable_rows.js"></script>
    ';
    $args = get_args_from_url();

    if (isset($args['view'])) {
        if ($args['view'] == 'users') {
            echo '
  <script src="js/upload.js"></script>
        ';
        }
    }
} else if ($_SERVER['SCRIPT_NAME'] == '/compose.php') {
    echo '
    <script src="js/md_preview.js"></script>
  ';
}
?>
</footer>

</html>
