Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Web Counter

Posted on 2004-10-16
2
Medium Priority
?
185 Views
Last Modified: 2010-05-18
Ok, I use FrontPage to build my page, and everytime I have added a web counter it has been handled but my web hoster, but now I am in charge of my job intranet's website, well my sections. And I need to know how to add a web page counter to it. Please help me
0
Comment
Question by:erichss
2 Comments
 
LVL 27

Expert Comment

by:Diablo84
ID: 12330480
If you have PHP available here is a compact example:

<?php
$file = $_SERVER['DOCUMENT_ROOT']."/hitcount.txt";
$len = 6; //numbers to display (for padding)

$count = @file_get_contents($file);
if (empty($count)) $count = 1;
$count = sprintf('%0'.$len.'u', $count);
$handle = fopen($file,"w");
fwrite($handle, $count+1);
fclose($handle);

echo $count;
?>

file extension must be .php
0
 
LVL 4

Accepted Solution

by:
Tagor earned 750 total points
ID: 12334641
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question