Hi!!,
I am a beginner in PHP , but I want a piece of code which I can use in my website to keep track of the no. of visitors (HIT COUNTER). Please help me.

<?php

/* first you will need to create a text file somewhere and give ita name obviously. In this example I will call it hits.txt */
$stored = "hits.txt"; 

 /* 
The following function when called gets the text filenamed in the above variable '$stored', then opens it forreading and writing, saves its contents in variable $stuffcloses it, then opens it again, adds 1 to $stuff, displays $stuff and then saves and closes the file again. */ 

function displayHitThingy($stored) 
{      
$fp = fopen($stored,rw);      
$stuff = fgets($fp,9999);      
fclose($fp);      
$fp = fopen($stored,w);      
$stuff += 1;      
print "$stuff";      
fputs($fp, $stuff);      
fclose($fp); 
}  
/* Now you just display it on your page somewherewith the following */
?>
Page hits: <?php displayHitThingy($stored); ?>
<?php
/* Thats it. You can of course use it on more than onepage, just remember to change the textfiles name for eache.g. page1.txt page2.txt and so on.. */
?>

yes but how do you create a box/table to show people visiting how many views/replies a thread/picture gets. How do you even keep track of views/replies so info can be displayed ina table. Maybe I'm typing the wrong words but I canno't find this info anywhere. Do you use PHP or what.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.