Monday, 30 November 2015

40_find_number_of_visitor_php

FIND VISIT IN OUR SITE.


1) Create two PHP page home.php, calculate_visit.php and one find_visit.txt file. Put initial value 0 [zero] in find_visit.txt file.


2) Open calculate_visit.php file and right the code as specify below.





3) Here in the first line we specify our text file very we have initialize value zero. In next line we are going to open the file in read mode. Then after we want to read all the data/size from text file so we use filesize() function of PHP.


4) Read the current value and closes the file. Now after reading the value we want to increment the current value with 1. So again open the file using fopen() function with mode “w”. Using fwrite() function write the incremented variable value and close it again.


5) Open home.php file, include calculate_visit.php file and call the function find_visiter().


6) Run the page home.php as many times as you want and check find_visit.txt file.



No comments:

Post a Comment