Jump to content


Photo
- - - - -

SIMPLE COUNTER


  • Please log in to reply
No replies to this topic

#1 fgd46tgh7ddd

fgd46tgh7ddd

    Young Padawan

  • Members
  • Pip
  • 26 posts
  • Gender:Female

Posted 13 September 2005 - 12:50 AM

// Hi all!
// it's a simple php counter. copy and paste! :yoda:

Create a txt file = "counter.txt";

IF ( you want to use this counter with a php page ) {

php file (Insert the following code into your php page) {

<p><?php
$fp = fopen("counter.txt", "r");
$count = fread($fp, 1024);
fclose($fp);
$count = $count + 1;
echo "<p>Page views: " . $count . "</p>";
$fp = fopen("counter.txt", "w");
fwrite($fp, $count);
fclose($fp);
?></p>

}

} else {

Create a php file = "counter.php";

php file (copy and paste) {

<?php
$fp = fopen("counter.txt", "r");
$count = fread($fp, 1024);
fclose($fp);
$count = $count + 1;
$fp = fopen("counter.txt", "w");
fwrite($fp, $count);
fclose($fp);
?>

}

htm, html, jsp, ... page (copy and paste) {

<IFRAME src="counter.txt" width="15" height="15" frameborder="0" border="0" scrolling="no" marginheight="0" marginwidth="0"></IFRAME>

}

}

if (U have any problem with this tutorial) {

getURL("Tell Me")

}

// Have Fun!

Edited by Donna, 16 September 2005 - 08:07 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users