Hits Counter - RMB Scripting
You appear not to 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
Get the date of every ...
If...Else on one line ...
Drop Calendar Function
Single VS Double
Understanding Variables
Latest Comments
Simple Comment System
Simple Comment System
Simple Comment System
Simple Comment System
Private Message System
Stats
Total Members: 585 [231]
Total Tutorials: 276
Newsest User: zaithstery
Todays Unique Hits: 71
Users Online: 0
 
8 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: 1133
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