$HTTP_SESSION_VARS were depreciated long ago (8 years), turned off by default in php5, and completely removed in php6. Use $_SESSION
Each of your header() redirect statements needs an exit; statement after it to prevent the remainder of the code on the page from being executed. All a hacker needs to do is ignore the header() redirect and he can access the content on the page anyway.
The log in code is not escaping the data being put into the SELECT query, so it is possible for a hacker to easily cause the query to match any row in your table without knowing the actual password.
The check.php code does not contain any logic to check what is in the session variables, so it is unlikely that is the actual code. If that is your actual code, you likely have a header() error that is preventing the header() redirect from having any affect, because all visitors (even logged in ones) would be redirected by that code.