Hits Counter - RMB Scripting
You appear not have have an account with us, Click HERE to register an account...
RMB Scripting
Navigation
  Home
  Contact
  FAQ
  Forum
  Topsites
  Members
  Affiliates
  Arcade <-- New!
  IoxHost
Downloads
  Templates
  Scripts
  Fonts
  Image Sets
  Software
  Other
 
Tutorials
  .htaccess
  Photoshop
  C/C++
  CSS
  Macromedia Flash
  MySQL
  PHP
  PHP - User System
  HTML
  Javascript
  Macintosh
  Macromedia Fireworks
  Visual Basic
  Visual C#
  Windows
  Python
  Other
 
Latest Tutorials
Single VS Double
Understanding Variables
C# Server Port Check
All PHP / Apache Funct...
Block User\'s Direct A...
Latest Comments
Users Online
Users Online
Single VS Double
Single VS Double
Liveprinter For Mac
Stats
Total Members: 568 [220]
Total Tutorials: 272
Newsest User: noelm
Todays Unique Hits: 8
Users Online: 0
 
1 Guests
Poll
Should we change our name?
Hmmmm, Yes!!
Maybe
Depends on what to
NO!
Main Content
Tutorial: Hits Counter By DanielXP
1. Create a directory called hits/ and CHMOD it to 777

2. Copy the below code and name it index.php

   
PHP:
<?
//Sees if the counter.dat file is aready mande
if(file_exists("counter.dat"))
{
//if the file exists open it
$exist_file fopen("counter.dat""r");
$new_count fgets($exist_file255);
//adds one to the current hits
$new_count++;
//closes the file
fclose($exist_file);
//shows the new hit count
print("$new_count");
$exist_count fopen("counter.dat""w");
fputs($exist_count$new_count);
fclose($exist_count);
}
else
{
//if don't exist we make one 
$new_file fopen("counter.dat""w");
fputs($new_file"1");
//shows hits
print("1");
//closes file
fclose($new_file);
}
?>



Then just include it using an iframe or a php include.
NOTE: The script will not work unless the hits directory is CHMOD to 777!
Difficulty: Easy
Views: 1059
Rating:
Comments
Posted on Saturday 10th May 2008 at 01:21 PM
Alexwhin
Nice. Simple. Effective. I like it.
Notice:
Remember to post long codes on our pastbin! - (http://rmb.pastebin.com/)
Add Comment
You must be logged in to post a comment.
Good Morning Guest
Username: 
Password: 
Remember Username
Links
RMB Arcade
$2.50 Resellers
Free Domains
Free Games
Affiliates