Thursday, 16 August 2012

PHP Examples - Session - Pageviews And PHP

<?php

 session_start(); // Starting PHP Session
 if(isset($_SESSION['pageviews'])) // Checking Session variable is set or not  
  $_SESSION['pageviews']+=1;
 else
  $_SESSION['pageviews']=1; // Setting Session variable 
 
 //echo $_SESSION['pageviews'];

?>  
<html >
<head>
<title>PHP EXAMPLE 11 : SESSION </title>
</head>

<body>

<?php
 
 echo "<br/>PHP Example 11";
 echo"<br/>"; // line break
 echo"<h1>";
 echo"SESSION : Number of Pageviews";
 echo"</h1>";
 echo"<br/><br/>";
 echo "<b><h2> Number of Page Views: ".$_SESSION['pageviews']."</h2></b>";
 
 echo "<br/><b>";
 echo"WWW.2K8618.BLOGSPOT.COM";
 echo"</b>";
?>
</body>
</html>

1 comment: