Sunday, 12 August 2012

How to delete the COOKIE after Log Out of the section.

                         /*****************Create HOME page************************/

 <html>
 <title>  Web 7Lessons</title>
<body>
<div class='top_margin' > // top margin
<ul class="webfix_panal_1">
<li class="li" name="home"><a href="#">HOME</a></li>
<li class="li" name="aboutus"><a href="#">ABOUT US</a></li>
<li class="li" name="services"><a href="#">SERVICES</a></li>
<li class="li" name="products"><a href="#">PRODUCTS</a></li>
<li class="li" name="contactus"><a href="#">CONTACT US</a></li>
</ul>
<div>



                    /***************Create a Cookie for your file action *****************/


var name='cookie_name';
if(readCookie(name)=='1')
{
SetCookie("webfix_panal_1",1);
tabsDisplay(empID,'aboutus');
}
else if(readCookie(name)=='2')
{
SetCookie("webfix_panal_1",2);
tabsDisplay(empID,'services');
}
else if(readCookie(name)=='3')
{
SetCookie("webfix_panal_1",3);
tabsDisplay(empID,'products');
}
else if(readCookie(name)=='4')
{
SetCookie("webfix_panal_1",4);
tabsDisplay(empID,'contactus');
} else if(readCookie(name)=='0')
{
SetCookie("webfix_panal_1",0);
tabsDisplay(empID,'home');
}

</body>
</html>






                                /***************** CSS ****************/
top_margin.{
text_align:center;
padding-top:10px;
height:36px;
padding-left:10px;
}
li.{
font-size:18px;
margin-left:30px;
text-align:center;
}


                                    /****************** LogoutAction file ****************/

<?php

Secssion_start();
class Logout Action extends DBAction
{
function getDefaultview(&$controller,&$request,&$user)

{

if(isset($_COOKIE['Cookie_name']))

{
  setcookie("cookie_name",0);
 }

}



NOTE:


When user will Log in to the site.

> The actions that they do will be there till they log out of the site  due to SetCookie

After Log out 

>As the user will Log in again  they will not find previous values which was set .




With Regards
HIMA.J
web7lessons.com
jhimamurthy@gmail.com