Showing posts with label viewer in php. Show all posts
Showing posts with label viewer in php. Show all posts

Wednesday, December 17, 2014

Count Number of Visitors in PHP

In this article I would like to share with a very simple program  that is written in PHP to count the number of views on a web page. In order for us to count the number of views in a particular website in their webpage we are using sessions function in PHP. The sessions is a process that we want start if login or visit a particular website it is very similar to cookies that is being stored in our web browsers the only difference is cookies save the information in the history of our browser. Everytime the user open this web page it will increment the number it  is the same way is we just refresh our web page using using F5 from our keyboard.

I hope you will find my work useful to add functionality in your website that using PHP and MySQL as your main developmental language. If you have some questions regarding my work feel free to send me an email at jakerpomperada@yahoo.com and jakerpomperada@gmail.com.

People here in the Philippines who wish to contact me can reach me through my mobile numbers 09173084360 and 09993969756

Thank you very much and Happy Programming



Sample Output of Our Program


Program Listing

<html>
<title> Count Number of Views </title>
<body bgcolor="lightgreen">
<style>
div#first {
 position:absolute;
 right:820px;
 }
</style>
<br><br>
<font face="comic sans ms" size="3" color="blue">
<?php

session_start();

if(isset($_SESSION['visitor']))
     $_SESSION['visitor']+=1;
else
    $_SESSION['visitor']=1;
    echo"<h1> <div id='first'>Total Number of Views : ".$_SESSION['visitor']." </div></h1>";
echo "<br><br><br>";
echo "<h3> Written By: Jake R. Pomperada  </h3>";

echo "<font size='5'>Email Address : </font>";
echo "<br>";
echo "<h3>jakerpomperada@yahoo.com<br>";
echo "jakerpomperada@gmail.com </h3>";
?>
</font>
</body>
</html>