logout using cookies php
<p>This is the way i set cookies for authentication purpose, but i need a logout function to destroy those cookies...and send back to index page, please help me out??</p>

<pre><code>&lt;?php
require_once('Template.php');
require_once('common/common.php');

$mes="";
if($value['m']==1)
 {
    $mes="Invalid Username / Password.";
    setcookie("USERNAME", "", time()-3600);
 }

$template =&amp; new Template('html/login.html');
$template-&gt;AddParam('mes',$mes);
$template-&gt;EchoOutput();

?&gt;
</code></pre>

<p>actually i forgot to post the login authentication code...</p>

<pre><code>&lt;?php
 require_once('class/User.php');
 require_once('common/common.php');
 $user= new User();

 $user-&gt;getUser($value['username'],$value['password']);

 if($user-&gt;ID != null){
setcookie("USERNAME", $user-&gt;USERNAME);
header("Location:adminhome.php");

  }
 else
 {
 header("Location:index.php?m=1");
 }
  ?&gt;
</code></pre>
