PHP Code:
<?php
/*
Front Controller Script:
NOTE PATTERN: index.php?theme=1
*/
/* Default Theme Template (unless otherwise specified) */
$pgtheme = '4'; /* 1, 4, OR 24 */
if(isset($_GET['theme']) && in_array(array(1, 2, 24), $_GET['theme'])){ //if a theme is set and in the allowed array
$pgtheme = $_GET['theme']; //set the theme to the requested theme
}else if(isset($_COOKIE['theme'])){ //else if a cookie exists
$pgtheme = $_COOKIE['theme']; //set the theme to it
}
setcookie ('theme' , $pgtheme, time() + (6 * 30 * 24 * 60 * 60), '/'); //set the cookie for approx 6 months
/* THEME: Include or Static */
$theme= 'theme'.$pgtheme.'.php';
/* THEME INCLUDE FOR FILL/FORMATTING: All similarly formatted */
include ($theme); // returns html with variable and includes
?>
Bookmarks