put $index in index

moved the variable $index into the main index.php file