I have a log in page where I want to set my session.But my session is not setting !!!!

```
<!--
Author: Dibyendu Konar

-->
<?php
session_start();
print_r($_SESSION);
include "db.php";
?>
<!DOCTYPE html>
<html>
<head>
    <title>Handikap admin login</title>
        <meta charset="utf-8">
        <link href="css/style.css" rel='stylesheet' type='text/css' />
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
        <!--webfonts-->
        <link href='http://fonts.googleapis.com/css?family=Open+Sans:600italic,400,300,600,700' rel='stylesheet' type='text/css'>
        <!--//webfonts-->
</head>
<body>
     <!-----start-main---->
     <div class="main">
        <div class="login-form">
            <h1>Admin Login</h1>
                    <div class="head">
                        <img src="images/user.png" alt=""/>
                    </div>
                <form method="POST" onsubmit="errorCheck()">
                        <input type="text" name="email" id="email" class="text" value="EMAIL" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'EMAIL';}" >
                        <input type="password" id="password" name="password" value="PASSWORD" onfocus="this.value = '';" onblur="if (this.value == '') {this.value = 'Password';}">
                        <div class="submit">
                            <input type="submit" name="submit" value="LOGIN" >
                    </div>  
                    <p><a href="<?php echo  "./login"; ?>">Forgot Password ?</a></p>
                </form>
            </div>
            <!--//End-login-form-->

        </div>
             <!-----//end-main---->

</body>
  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript" charset="utf-8" async defer>
function errorCheck()
{
    var password = $('#password').val();
    var email    = $('#email').val();
    if(((password == '') || (password == 'password') )|| ((email == '') || (email == 'EMAIL')))
    {
        alert("Please enter values");
        return false;
    }
}   

</script>
</html>

<?php
function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}
function redirect($url) {
    if(!headers_sent()) {
        //If headers not sent yet... then do php redirect
        header('Location: '.$url);
        exit;
    } else {
        //If headers are sent... do javascript redirect... if javascript disabled, do html redirect.
        echo '<script type="text/javascript">';
        echo 'window.location.href="'.$url.'";';
        echo '</script>';
        echo '<noscript>';
        echo '<meta http-equiv="refresh" content="0;url='.$url.'" />';
        echo '</noscript>';
        exit;
    }
}

if(isset($_POST['submit']))
{
    /*-------------Getting the value------------*/
    $emailId     = trim($_POST["email"]);
    $passwordAdmin    = trim($_POST["password"]);
    /*------------------------------------------*/

    //echo $emailId.'<br/>'.$passwordAdmin;
    $result =mysql_query("SELECT * FROM `admin`");
    if(mysql_num_rows($result)>0)
                {
                    while($row=mysql_fetch_assoc($result))
                        {
                            extract($row);
                            echo '<pre/>';
                            $values[] = $row;
                        }
                }
    $databaseAdminEmail = $values[0]['email'];
    $databaseAdminPassword = $values[0]['password'];
    //echo $databaseAdminEmail.'<br/>'.$databaseAdminPassword;
    /*-----------------Validation debug--------------------------*/

    if ($databaseAdminEmail != $emailId) 
        {
            header('Location: '.$_SERVER['PHP_SELF'].'?auth=user_not_found');

        }

    if($databaseAdminPassword != $passwordAdmin)
        {
            header('Location: '.$_SERVER['PHP_SELF'].'?auth=password_error');
            //echo "stupid";
        }
    else
        {

                $_SESSION["admin"] = "log_in";
                echo "testpassed";
                echo $_SESSION['login'];
                $newURLExploded = explode("/admin.php", $newURL);
                $targetUrl = "playerlist.php";
                redirect($targetUrl);

                //die();
        }       
}
?>

```

and hence not begin able to acess it also into anotherfolder of the same project

where the coding stricture is like this

```
<!DOCTYPE html>
<?php
session_start();
echo $_SESSION['admin'];
include "db.php";
?>
<html>

<head>
    <meta charset='UTF-8'>

    <title>User information</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="css/style.css">

    <!--[if !IE]><!-->
    <style>

    /* 
    Max width before this PARTICULAR table gets nasty
    This query will take effect for any screen smaller than 760px
    and also iPads specifically.
    */
    @media 
    only screen and (max-width: 760px),
    (min-device-width: 768px) and (max-device-width: 1024px)  {

        /* Force table to not be like tables anymore */
        table, thead, tbody, th, td, tr { 
            display: block; 
        }

        /* Hide table headers (but not display: none;, for accessibility) */
        thead tr { 
            position: absolute;
            top: -9999px;
            left: -9999px;
        }

        tr { border: 1px solid #ccc; }

        td { 
            /* Behave  like a "row" */
            border: none;
            border-bottom: 1px solid #eee; 
            position: relative;
            padding-left: 50%; 
        }

        td:before { 
            /* Now like a table header */
            position: absolute;
            /* Top/left values mimic padding */
            top: 6px;
            left: 6px;
            width: 45%; 
            padding-right: 10px; 
            white-space: nowrap;
        }

        /*
        Label the data
        */

    }

    /* Smartphones (portrait and landscape) ----------- */
    @media only screen
    and (min-device-width : 320px)
    and (max-device-width : 480px) {
        body { 
            padding: 0; 
            margin: 0; 
            width: 320px; }
        }

    /* iPads (portrait and landscape) ----------- */
    @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
        body { 
            width: 495px; 
        }
    }

    </style>
    <!--<![endif]-->

</head>

<body>

    <div id="page-wrap">

    <table>
        <thead>
        <tr>
            <th>Player id</th>
            <th>Percentage of complition</th>
            <th>Tag</th>
            <th>Device</th>

        </tr>
        </thead>
        <tbody>

<?php

        $result =mysql_query("SELECT * FROM `handikap`");
            if(mysql_num_rows($result)>0)
                {
                    while($row=mysql_fetch_assoc($result))
                        {
                            extract($row);
                            echo '<pre/>';
                            $values[] = $row;
                        }
                }
        $sizeOfArray =  sizeof($values);
        if($sizeOfArray >= 0)
                {
                       for($i=0;$i<$sizeOfArray;$i++)
                       {

                            echo "<tr>
          <td>".$values[$i]['playerId']."</td>
          <td>".$values[$i]['percentageComplete']."%"."</td>
          <td>".$values[$i]['tag']."</td>
          <td>".$values[$i]['device']."</td>

        </tr>";
                       }
                }
?>
        </tbody>
    </table>

    </div>

</body>

</html>

```

Now my question is where I am making the error...????
as I have set the session as well as fetching it also hence no out put....!!!!!

and I want to destroy my session in logout.php

```
<?php
session_destroy();   
unset($_SESSION["admin"]);
$target = "admin.php";
header( 'Location: ' . $target ) ;
?>

```

hence session in not destroying