Sunday, October 21, 2012

Implementation Session With Cookies


       In this discussion we will discuss a script to count the number of visits by using session cookies are implemented. The trick is to add the script below on checksession.php


If(!isset ($_COOKIE[“counter”])){
      $i=0;
}
Else{
      $i=$_COOKIE[“counter”];
      $i++;
      Setcookie(“counter”,$i,time()+3600*24*365);
Echo “you've already visited “.$i.”times”;

Enter the above script on checksession.php

No comments:

Post a Comment