<?php
$validTemplates = array();
$validTemplates = scandir($basepath . '/templates');
unset($validTemplates[0]); //get rid of . and ..
unset($validTemplates[1]);
if (in_array($_GET['id'], $validTemplates)) {
$_SESSION['templatePath'] = $basepath . '/templates/' . $_GET['id'];
$_SESSION['templateURL'] = $basehttp . '/templates/' . $_GET['id'];
} else {
$_SESSION['templatePath'] = $template_path;
$_SESSION['templateURL'] = $template_url;
}
header("Location: $basehttp");exit();
?>