Update index.php

Added the backend for stats, removed various inval() and replaced with FILTER_VAR