Today first time I use cookie but I am facing a warning
Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\session.php:11) in E:\xampp\htdocs\home_page.php on line 7
This is my code:
<?php
include("session.php");
?>
<?php
$Month = 2592000 + time(); //this adds 30 days to the current time
setcookie(AboutVisit, date("F jS - g:i a"), $Month);
?>
<?php
if(isset($_COOKIE['AboutVisit']))
{
$last = $_COOKIE['AboutVisit'];
echo "Welcome back! You last visited on ". $last;
}
else
{
echo "Welcome to our site!";
}
?>
<html>
<head>
<title>Home Page</title>
<script src="flowplayer-3.1.4.min.js"></script>
</head>
<body bgcolor="white">
<?php include('search_file.php'); ?>
<font color="red"><b><h2 align="center">Deepak Narwal Welcomes You</h2></b></font>
<hr size="2" width="50%">
<a href="logout_file.php"><h3 align="right">Sign Out</h3></a>
<a
style="display:block;width:250px;height:200px;"
id="player">
</a>
<script language="JavaScript">
flowplayer("player", "flowplayer-3.1.5.swf" , { clip: { autoPlay : false, autoBuffering: true}, playlist: [ 'video.flv', 'flowplayer.flv'] }); //create a object of clip name
</script>
<object classid="clsid:67DABFBF-D0AB-41fa-9C46-CC0F21721616" align="right" width="320" height="260" codebase="http://go.divx.com/plugin/DivXBrowserPlugin.cab">
<param name="custommode" value="none" />
<param name="loop" value="true" />
<param name="autoPlay" value="false" />
<param name="autoBuffering" value="true" />
<param name="src" value="http://localhost/idiot.mkv" />
<embed type="video/divx" src="http://localhost/idiot.mkv" custommode="none" width="250" height="200" loop="true" autoPlay="false" pluginspage="http://go.divx.com/plugin/download/">
</embed>
</object>
<br /><a href="upload_file.php"><h4>Up-Load Files</h4></a>
<br /><br />
<a href="list_files.php"><h4>List All Up-Loaded Files</h4></a>
</body>
</html>
What is this error and how can I hide warnings from my webpage?
Is there any particular place for putting cookies or can I put cookie anywhere like above cookie?
This is my session.php
<?php
session_start();
if(!isset($_SESSION['employee']))
{
echo "Your are Logged Out";
exit;
}
else
{
echo "Welcome Mr.".$_SESSION['employee']['username'].";
}
?>