2627 posts Put a Donk On It
  • Weekly Top Seller
  • Elite Author
  • Exclusive Author
  • Featured Author
+11 more
ThemeProvince
says

Hey guys here’s an easy way to track your items using simple php and text files.

1. Create a text file. Call it no_of_hits.txt. Leave it empty.

2. Create a php file and call it counter.php.

3. Here is the php code i created. Place it in the counter.php. Follow the comments.


<?php // This gets the figure inside the text file.

$number_of _hits = file_get_contents("no_of_hits");

// We give our item a unique id

if ($_GET["id"] == 1) {

 $hits = $hits + 1; 

}

// We add the the new visitor hit.

$number_of_hits = $number_of_hits + 1;

// Open our document

$manage_hits = fopen("no_of_hits.txt", "w"); 

// Replace the old hit counter

fwrite($manage_hits, $hits); 

// Close and save the file.

fclose($manage_hits);

// Print our item's hits.

print "Your item has $hits hits";

?>

4. Save and upload to your server or host.

5. On your item page place an image tag at the bottom.


<img src="http://www.yourwebsite.com/counter.php?id=1" />

Get your item id that we defined earlier and replace with mine above. You can leave it at 1 if you want.

6. Sit back and enjoy. :)

Only when someone visits your item’s page will the counter activate. therefore refreshing on the exact location of php doc wont increase the number of hits.

2627 posts Put a Donk On It
  • Weekly Top Seller
  • Elite Author
  • Exclusive Author
  • Featured Author
+11 more
ThemeProvince
says

EDIT : replace

$number_of _hits = file_get_contents(“no_of_hits”);

with

$number_of_hits = file_get_contents(“no_of_hits.txt”);

767 posts
  • 6 Years of Membership
  • Author Level 3
  • Collector Level 4
  • Exclusive Author
+4 more
outandouter
says

Now this is cool! great work…

2627 posts Put a Donk On It
  • Weekly Top Seller
  • Elite Author
  • Exclusive Author
  • Featured Author
+11 more
ThemeProvince
says

The top post has some errors… but this is a working version…

Download the source code here:

Click here to download a working version.

Click here to see a live example currently tracking my item.

3757 posts
  • Elite Author
  • Spain
  • Author Level 8
  • Featured Author
+11 more
pezflash
says

Nice share! Thank you Phoenix.

9 posts
  • Author Level 2
  • Exclusive Author
  • 2 Years of Membership
  • Netherlands
F4LLCON
says

Does this still work? I am trying a similar thing, but it does not load it? I have an googleanalytics.html on the server, a pageloader.php that loads the .html file, and then I am using <img src=”http://website.com/pageloader.php” />.

When I directly go to the site http://website.com/pageloader.php, analytics confirms I am on it, but when I go on my profile on 3DOCEAN, it does not show I am on the profile.

Did 3DOCEAN fix this or am I doing something wrong?

66 posts
  • Author Level 2
  • Collector Level 1
  • Freebie
  • Featured Author
+3 more
yuanhao_viva
says

thanks man,really useful

by
by
by
by
by
by