finish function of index.php