redirect page to root path
<p>i have this class here and what im trying to do is, if the checking of something equals false then the user will be redirected to the root domain path. but its not working. 
here is the class</p>

<pre><code>class security {
    function checkAuth() {
        if(isset($_COOKIE['AUTHID'])) {
            $cookie = $this-&gt;secure($_COOKIE['AUTHID']);
            $query = mysql_query("select username,password,active from tbl_users where password = '$cookie'") or die(mysql_error());
            while($row = mysql_fetch_assoc($query)) {
                //check if cookie is set
                if(!isset($_COOKIE['AUTHID'])) {
                    header("Location: ".realpath($_SERVER['HTTP_HOST']));
                }

                //check if user is active
                if($cookie == $row['password']) { 
                    if($row['active'] == '0') {
                        setcookie("AUTHID","",time() - 100000);
                        header("Location: ".realpath($_SERVER['HTTP_HOST']));
                    }
                    else { //user is active
                    }
                }
                //check if hash in cookie matches hash in db
                if($cookie != $row['password']) { 
                    setcookie("AUTHID","",time() - 100000);
                    header("Location: ".realpath($_SERVER['HTTP_HOST']));
                }
            }
        }
    }
}
?&gt;
</code></pre>
