Write a program that keeps track of how many times a visitor has loaded the

page (using session or cookies).



<?php

session_start();

if(isset($_COOKIE["hello"]))

{

$c=$_COOKIE["hello"];

echo $c++." new visitors";

setcookie("hello",$c, time() + (86400 * 30));

}

else

{

         $c=0;

         setcookie("hello",$c, time() + (86400 * 30));

}

?>

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post