TY_BCS_PHP_SLIP 12_1



Slip no. 12. Write a PHP script to keep track of number of times the web page has been access.
 [Use Session]
PHP file :
<html>
<head>
<title> Number of times the web page has been viited.</title>
</head>
<body>
<?php
                session_start();
                if(isset($_SESSION['count']))
                $_SESSION['count']=$_SESSION['count']+1;
                                else
                                $_SESSION['count']=1;
                echo "<h3>This page is accessed</h3>".$_SESSION['count'];
?>

No comments:

Post a Comment

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