I tried a login and logout function in a signin bootstrap theme and it worked fine. But am not able to logout the session in my other tenplate when I use the same code which I used previously which worked. I tried all most all the solutions found in internet. I am getting a blank page when I click on Logout link.

**login.php**

```
<?php
session_start();
if (!empty($_SESSION['login_user'])) {
header('location:index.php');
}
?>
---html code---

<?php

define('DB_SERVER', 'localhost');
define('DB_USERNAME', 'root');
define('DB_PASSWORD', '');
define('DB_DATABASE', 'foodchain');
$db = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE);

if($_SERVER["REQUEST_METHOD"] == "POST") {

  $myusername = mysqli_real_escape_string($db,$_POST['email']);
  $mypassword = mysqli_real_escape_string($db,$_POST['password']);

  $sql = "SELECT email,password FROM user_register WHERE email='$myusername' and password = '$mypassword'";
  $result = mysqli_query($db,$sql);
  $row = mysqli_fetch_array($result,MYSQL_ASSOC);

  $count = mysqli_num_rows($result);

  if($count == 1) {

   $_SESSION['login_user'] = $myusername;

    header('Location:index.php');
 }else {

     $logmsg = "Invalid Username or Password";

  }
}
?>

```

**check\_login.php**

```
 <?php
 session_start();
  if (!isset($_SESSION['login_user']) || empty($_SESSION['login_user'])) {
 header('location:login.php');
 }
?> 

```

**logout.php**

```
<?php
 session_start();
 session_destroy();
 header("Location:login.php");
 die();
 ?> 

```

**index.php**

```
<?php
include('check_login.php');
?>

```

Its perfectly working when I don't use the template(downloaded from some website), or when I use the bootsrap signin template.