I created a userpanel which is accessible when a user registers and log's in. Everything works fine but when I want to exit the userpanel these errors occure:
Notice: A session had already been started - ignoring session_start() in C:\xampp\htdocs\eshop\userpanel_exit.php on line 2
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\eshop\top.php:230) in C:\xampp\htdocs\eshop\userpanel_exit.php on line 4
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\eshop\top.php:230) in C:\xampp\htdocs\eshop\userpanel_exit.php on line 5
my exit section code:
**
<?php
session_start();
unset($_SESSION['email']);
setcookie('remember','',time()-3600,'/');
header('location:login.php');
?>
**
my userpanel code:
<?php
session_start();
if(!isset($_SESSION['email'])){
    if(isset($_COOKIE['remember'])){ $_SESSION['email']=$_COOKIE['remember']; }
    else{ header('location:login.php'); }
}
include('connect.php');
$query="select * from tblusers where email='".$_SESSION['email']."' ";
$stmt=$db->prepare($query);
$stmt->execute();
$myresult=$stmt->fetch(PDO::FETCH_ASSOC);
$userid=$myresult['id'];
$fname=$myresult['fname'];
$lname=$myresult['lname'];
$email=$myresult['email'];
$sex=$myresult['sex'];
$pwd=$myresult['password'];
$state=$myresult['state'];
$city=$myresult['city'];
$mobile=$myresult['mobile'];
$tel=$myresult['tel'];
$postalcode=$myresult['postalcode'];
$address=$myresult['address'];
$imgaddress=$myresult['imgaddress'];
$emailnews=$myresult['emailnews'];
$smsnews=$myresult['smsnews'];
$item='info';
if(isset($_GET['item'])){$item=$_GET['item'];} 
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title> 
<?php
switch($item){
    case 'info': echo 'مشخصات';
    break;
    case 'orders':echo 'سفارشات';
    break;
    case 'msg':echo 'پیغام ها';
    break;
    case 'chpass':echo 'تغییر رمز عبور';
    break;
    case 'exit':echo 'خروج';
    break;
}
?>
</title>
<link rel="stylesheet" href="css/maincss.css" >
<script src="js/jquery-1.10.2.min.js"></script>
<link rel="stylesheet" href="css/jquery.fileupload.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<style>
#man{ <?php if($sex==1){  ?>  background-position:0px 11px;   <?php } ?> }
#woman{ <?php if($sex==0){  ?>  background-position:0px 11px;   <?php } ?> }
</style>
</head>
<body>
<?php 
include('top.php');
?>
<style>
#undermenu{height:auto; float:right;}
</style>
<div id="undermenu">
    <div id="undermenu1">
    <div id="col-right-parent">
    <div id="col-right">
    <style>
    #myupload img{width:150px; height:150px;}
    </style>
        <h2> تصویر کاربر </h2>
        <div id="myupload" style="width:150px; height:150px; margin:3px auto; background:url(img/person.png)
         center no-repeat;">
         <?php if($imgaddress!=''){ echo '<img src="'.$imgaddress.'"  />' ; }   ?>
         </div><!-- my upload -->
        <?php if($item=='info') { ?>  
        <div id="uperror" style="color:red; text-align:center; vertical-align:middle; margin-bottom:10px;"></div><!-- uploadError-->
        <span style="margin-left:70px; margin-top:5px;" class="btn fileinput-button btn-success">
        <span>انتخاب تصویر</span>
        <input type="file" id="fileupload" name="files[]" multiple>
        </span>
        <div style="width:180px; margin:7px auto; position:relative;opacity:0;" id="progress" class="progress">
        <div id="percent" style="color:#ffffff; width:100%; height:100%; position:absolute; text-align:center; ">
        </div><!--percent-->
        <div class="progress-bar progress-bar-success"></div>
        </div>
<div id="files" class="files" style="display:none;"></div>
        <?php }  else{  ?>
        <style> #col-right{ padding-bottom: 15px; } </style>
               <?php } ?>
    </div> <!-- col-right-->
    <div id="panelmenu">
    <h2> امکانات کاربر</h2> 
        <ul>
        <li><a href="userpanel.php?item=info">مشخصات</a></li>
        <li><a href="userpanel.php?item=orders">سفارشات</a></li>
        <li><a href="userpanel.php?item=msg">پیغام ها</a></li>
        <li><a href="userpanel.php?item=chpass">تغییر رمز عبور</a></li>
        <li><a href="userpanel.php?item=exit">خروج</a></li>
        </ul>
    </div><!-- panel-menu-->
    </div> <!-- col-right-parent-->
    <?php
        switch($item){
        case 'info': include('userpanel_info.php');
        break;
        case 'orders':include('userpanel_orders.php');
        break;
        case 'msg':include('userpanel_msg.php');
        break;
        case 'chpass':include('userpanel_chpass.php');
        break;
        case 'exit':include('userpanel_exit.php');
        break;
        }
    ?>
    <div style="width:740px; height:70px; float:left;"></div>
<script>
.
.
some script
.
.
</script>
<?php
include('uploadscript.php');
?>
    </div><!-- undermenu 1-->
</div> <!-- undermenu -->
<?php
include('basketscript.php');
?>
</body>
</html>
 
     
     
     
     
     
    