Skip to content

Instantly share code, notes, and snippets.

@ss23
Created July 12, 2012 15:16
Show Gist options
  • Save ss23/3098793 to your computer and use it in GitHub Desktop.
Save ss23/3098793 to your computer and use it in GitHub Desktop.
<?php
function content($title = 0, $rq = 0) {
// If there is no site set, we can use a default here.
if (empty($_GET['site'])) {
$site = 'willkommen'; // Replace this with the default site
} else {
$site = $_GET['site'];
}
// We use $site, because its bad practice to modify $_GET/$_POST
$allowed_sites = array('willkommen', 'atemtherapie', 'atembehandlung', 'atemubungen'); // Fill in with the rest of the sites
// Check whether the specified site is valid and allowed
if (!in_array($site, $allowed_site)) {
// Invalid site -- use the default
$site = 'willkommen'; // Replace this with the default site
}
// Do our output
if ($title) {
if ($rq) {
echo "&raquo; ";
}
echo ucfirst($site);
} else {
require 'includes/' . $site . '.html';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment