PDA

View Full Version : Forum Link: how many times it is clicked


Triky
03-12-2009, 11:42 PM
Is there a way I can put near to my forum link (that points to my homepage) how many time it is clicked?

Triky
03-14-2009, 01:24 PM
Bump.

Mr-Moo
03-14-2009, 03:25 PM
What exactly are you trying to count?

I am somewhat lost, I know you are attempting to count the number of clicks, but the number of click to where?

Please answer the following questions as detailed as possible:
-What is your final goal?
-You want to count the clicks, unique or per-click?
-Clicks FROM where?
-Clicks TO where?
-Where would you like the number displayed at?
-Do you have an example we can see?

Answering these questions will ultimately help us assist you better.
Thank you!

Triky
03-15-2009, 01:08 PM
-What is your final goal? Just to know how could I do this type of script.
-You want to count the clicks, unique or per-click? Unique for user/visitor.
-Clicks FROM where? For example, if I have a forum called "vB.org" (wich is a vB forum link), and if a user click on it..
-Clicks TO where? As above.
-Where would you like the number displayed at? Near to the forum.
-Do you have an example we can see? I have seen something like this, maybe in another forum software. Ufortunately I don't remember where.

Thanks.

Mr-Moo
03-15-2009, 02:29 PM
Here are my instructions (since I am not sure if VB has this feature already built in).

You will need to create 2 files.
-counter.php
-log.txt

1. Create the file counter.php and place the following code within it, then save to your forum directory:
<?php
$filename = "log.txt";

$file = file($filename);
$file = array_unique($file);
$hits = count($file);
echo $hits;

$fd = fopen ($filename , "r");
$fstring = fread ($fd , filesize ($filename));
fclose($fd);
$fd = fopen ($filename , "w");
$fcounted = $fstring."\n".getenv("REMOTE_ADDR");
$fout= fwrite ($fd , $fcounted );
fclose($fd);
?>

2. Create a new log.txt file, and upload to your main forum directory. CHMOD this file to 0777.

3. Now that you have this information call it into the forums and display that single page.

Please let me know if this works for you.

Triky
03-15-2009, 09:39 PM
Thank you, Alex. One question. How do I call this script to work for all my forums wich are 'forum link(s)'? Wich is the code I should put in my plugin?