Hits Counter

Started on the old forum in September 2007 · view the original in the archive · old links redirect here

11 replies · 915 views · started 19 years ago · 1 min read

4 participants
Guest #1

I added this code to my login page $counter_array = file("counter.dat"); $all = $counter_array[0]+1; $fp = @fopen("counter.dat","wb"); @fputs($fp,$all); @fclose($fp);

echo ' Total hits: '.$all.' ';

But got the following error

Warning: file(counter.dat): failed to open stream: No such file or directory in /home/******/public_html/login.php on line 21

Can anyone tell me how to fix it please External image (may be gone)..Many thanks Tz

amylee Principal · 1,092 posts #4

just open notepad then save as counter.dat then upload

WhiteWarrior Principal · 1,419 posts #5
echo "Site Hits: ";
$fp=fopen("count.txt","a+"); fputs($fp,"1"); fclose($fp); $fp1=filesize("count.txt");
echo "$fp1";

make a new file and call it count.txt and cmod it to 777 and it will count hits for you.

Guest #10

$counter_array = file("counter.dat"); $all = $counter_array[0]+1; $fp = @fopen("counter.dat","wb"); @fputs($fp,$all); @fclose($fp);

echo ' Total hits: '.$all.' ';

its working fine.. you can upload this.... hope your prob will be solve after this

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close