PHP:退出问题?

Dear all my brothers and sisters. Recently I have create a project web site. Everthing works fine, but the problem is when I click log out the following error page appears. Also I have looks for the same problem in stack overflow and then I tried, but my issue is not fixed yet.

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster.
Error 404
localhost
Apache/2.4.7 (Win32) OpenSSL/1.0.1e PHP/5.5.6 

             **My PHP scripts for check LOGIN.PHP is:**

<?php  


    session_start();    


    $host="localhost"; // Host name

    $username="root"; // Mysql username

    $password=""; // Mysql password

    $db_name="fb"; // Database name

    $tbl_name="users"; // Table name    


    // Connect to server and select databse.

    mysql_connect("$host", "$username", "$password")or die("cannot connect");

    mysql_select_db("$db_name")or die("cannot select DB");    


    // username and password sent from form

    $name=$_POST['email'];

    $password=$_POST['pwd'];

//select data from database    


    $sql="SELECT * FROM $tbl_name WHERE usermail='$name' && userpasswd='$password'";

    $result=mysql_query($sql);    


    // Mysql_num_row is counting table row

    $count=mysql_num_rows($result);    


    // If result matched $myusername and $mypassword, table row must be 1 row    


    if($count==1){

        // Register $myusername, $mypassword and redirect to file "search.php"

        //session_register("$name");

        //session_register("$password");

        $_SESSION['usermail']= $name;

        $_SESSION['userpasswd']=$password;

        header("location:home.php");    
    }

    else {

        $msg = "Wrong Username or Password. Please retry";

        header("location:ErrorPage.html");      

    }

?>
                  **PHP script for HOME.HTML**
<?php

session_start();

require("checklogged.php");

?>
                  **My LOGOUT.PHP script is:**

<?php
session_start();
$_SESSION['usermail'] ='$name';
$_SESSION['userpasswd']='$password';
session_unset();
session_destroy();
header("Location: login.html");//This is my initial login page
?>

You are getting a 404 error , which means there is no such home.html file which you have put it in the logout.php file. Try changing that to index.php or login.php (if you have that)

Like this...

session_unset();
session_destroy();
header("Location: index.php"); //<-- Change here
?>

With header() you should better use a full url. Or, at least add a forward slash: header("Location: /home.html");

It could be that it is the reference to the page is incorrect i.e. the logout page is in a different directory to the home page use ../ to come up a directory level if it is required or use the full URL like:

 header("Location: http://www.mysite.com/home.php");