made check.php a function