diff --git a/index.php b/index.php index 67aba0a..7d45681 100644 --- a/index.php +++ b/index.php @@ -24,12 +24,18 @@ $cache = Cache::getCache(); // Obtain the id asked $last = Cache::getLastId(); -if (isset($_GET['id']) === true && is_numeric($id) === true) { +// Check if the id is valid, else use the last one +if (isset($_GET['id']) === true) { // is asked $id = $_GET['id']; - - if ($id > $last || $id < 0) { + + if( is_numeric($id) === true) { // is numeric + if ($id > $last || $id < 0) { // is in bounds + $id = $last; + } + } else { $id = $last; } + } else { $id = $last; } @@ -65,4 +71,4 @@ if (isset($_GET['ajax']) === true) { include_once Config::getTemplateFolder().'/stripit.xml'; } else { include_once Config::getTemplateFolder().'/'.Config::getTemplateName().'/template.html'; -} \ No newline at end of file +}