TY_BCS_PHP_SLIP 13_1



Slip no. 13  &  Slip no. 23
Write a PHP script to check how many times the web page access.[ Use cookies]
PHP file :
<?php
                if(isset($_COOKIE['cnt']))
                {
                                $x=$_COOKIE['cnt'];
                                $x=$x+1;
                                setcookie('cnt',$x);
                }
                                else
                                {
                                                setcookie('cnt',2);
                                                echo "you accessed this page 1st  time";
                                }
                echo "you accessed this page $x times";

?>

No comments:

Post a Comment

Note: only a member of this blog may post a comment.