bookmark - Site Counters - Help Needed

Site Counters - Help Needed

 
 Discussion by skpanda with 13 Replies.
 Last Update: March 9, 2005, 3:28 pm
 
bookmark - Site Counters - Help Needed  
    
free web hosting
 
I want a good Site counter(to keep track of visitors) for my site.....

can nebody temme.....

where will i get free stuff on this... (dont ask me to google..and try out..i am doing that..just in case u know someplace)

OR

Can how do i design my own (which seems quite....difficult for me)

Plz help!!
Satya

Fri Feb 18, 2005    Reply    New Discussion   


http://www.bravenet.com/ is a good site, but you have to stick up with the link to the bravenet site on everything you use from them. which completely sucks

Fri Feb 18, 2005    Reply    New Discussion   

Do you mean tracking them as in including their IPs, visiting time, and stuff? Or do you mean just a counter that increases everytime someone comes? The second one would be very easy.

Sat Feb 19, 2005    Reply    New Discussion   

Alright, here is a UNIQUE counter I made that requires php. A unique counter only counts how many DIFFERENT users go to your site. In other words, if you have fifty users who clicked on you site two hundred times, it will only show 50.


Alright, first things first. Assuming you have windows, right click on your desktop, and make a new text document. Rename the document to "unique.dat". Alright, make another new text document. Now open up your new text document and paste this into it:

CODE

<?php

$filename = "unique.dat";

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

$remote = $_SERVER["REMOTE_ADDR"];
$wholefile = file_get_contents($filename);

  if (preg_match("/$remote/i",$wholefile))
  {
     echo $hits;
  }
  else
  {
     $fd = fopen ($filename , "a+");
     $fout = fwrite ($fd , "$remote\n");
     fclose($fd);
     echo $hits;
  }

?>

Done? Alright, now go back to the desktop, and rename this text document "unique.php". Now upload the two files into your hosting account (whether, it's through cpanel or an ftp application). Set your "unique.dat" to CHMOD 777.

You're done. Now, wherever you want the number to be displayed on your site, place this in the html of your php file:

CODE

<?php include("unique.php"); ?>

It will only display the number so if you want you can also do something like this to display "unique hits = #"

CODE

unique hits = <?php include("unique.php"); ?>


And that's that. I tried to go through step by step, but if you need additional help feel free to ask ^_^

Sat Feb 19, 2005    Reply    New Discussion   


Wow I'm going to try that Its very informative. Before that I was using http://statcounter.com/ its free and I think its pretty good.

Another Question: How can I use the above code to implement on my blog at blogger.com, if that is at all possible?

Sat Feb 19, 2005    Reply    New Discussion   

QUOTE (redsox58)

Wow I'm going to try that Its very informative. Before that I was using http://statcounter.com/ its free and I think its pretty good.

Another Question: How can I use the above code to implement on my blog at blogger.com, if that is at all possible?
[post="18693"]<{POST_SNAPBACK}>[/post]

if you're refering to my post...then my answer is I don't know :P it depends on whether or not blogger.com allows php codes. If it does, you're going to have to do the script slightly differently because you will be hosting the "unique.dat" and "unique.php" on a different site, I'm presuming...

but if blogger.com does work, simply use:

CODE

<?php include("http://url-of-your-site/unique.php"); ?>

instead :P

Sat Feb 19, 2005    Reply    New Discussion   

QUOTE (skpanda)

I want a good Site counter(to keep track of visitors)  for my site.....

can nebody temme.....

where will i get free stuff on this... (dont ask me to google..and try out..i am doing that..just in case u know someplace)

OR

Can how do i design my own (which seems quite....difficult for me)

Plz help!!
Satya
[post="18670"]<{POST_SNAPBACK}>[/post]


I think it is not hard to find a creative counter , that's mean the layout is beautiful and contain a big function, but in your post you don't mention which counter you want .

And also it is easy to design by your own , not difficult if u know cgi or php . From ChronicLoser you have php counter and i am using a cgi counter it is downloaded from japaness website . I don't know japanese but I think it is easy to install if you have learn cgi language .

japanese counter : http://www.kent-web.com/

Sat Feb 19, 2005    Reply    New Discussion   

QUOTE (ChronicLoser)

Alright, here is a UNIQUE counter I made that requires php. A unique counter only counts how many DIFFERENT users go to your site. In other words, if you have fifty users who clicked on you site two hundred times, it will only show 50.
Alright, first things first. Assuming you have windows, right click on your desktop, and make a new text document. Rename the document to "unique.dat". Alright, make another new text document. Now open up your new text document and paste this into it:

CODE

<?php

$filename = "unique.dat";

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

$remote = $_SERVER["REMOTE_ADDR"];
$wholefile = file_get_contents($filename);

  if (preg_match("/$remote/i",$wholefile))
  {
     echo $hits;
  }
  else
  {
     $fd = fopen ($filename , "a+");
     $fout = fwrite ($fd , "$remote\n");
     fclose($fd);
     echo $hits;
  }

?>

Done? Alright, now go back to the desktop, and rename this text document "unique.php". Now upload the two files into your hosting account (whether, it's through cpanel or an ftp application). Set your "unique.dat" to CHMOD 777.

You're done. Now, wherever you want the number to be displayed on your site, place this in the html of your php file:

CODE

<?php include("unique.php"); ?>

It will only display the number so if you want you can also do something like this to display "unique hits = #"

CODE

unique hits = <?php include("unique.php"); ?>


And that's that. I tried to go through step by step, but if you need additional help feel free to ask :P
[post="18692"]<{POST_SNAPBACK}>[/post]


Thats a great code, good work.

Sat Feb 19, 2005    Reply    New Discussion   

A "UNIQUE" counter...never heard of that one before but I really like that idea. I think I'll try it out on my site. In fact, I think I'll try pairing it up with a regular counter. Thanks for sharing that with us.

Sat Feb 19, 2005    Reply    New Discussion   

sorry i was away!!
Thanks chronice loser!!
i am gonna try it out today!!
and certainly..will let u know if i have any queries..
Thanks again!!

Sun Feb 20, 2005    Reply    New Discussion   

this is really good! helps me downloading and trying out all the cgi scripts off the internet. this is really simple! but only works in php, right now i want to learn the damn language but cant get the local machine server working.!

i think this should be a in the tutorials section.

thanks again!

Sun Feb 20, 2005    Reply    New Discussion   

This deals mostly with php scripting of counters. So moved to Programming > Scripting


m^e

Tue Feb 22, 2005    Reply    New Discussion   

try not to use text file to store your hits data.
it will reset after a certain number of entries.
i use to store my hits data in text files, all entries reset to zero or blank after sometime but it stopped when i switch it to store databases.

Tue Feb 22, 2005    Reply    New Discussion   

QUOTE (ChronicLoser)


Alright, here is a UNIQUE counter I made that requires php. A unique counter only counts how many DIFFERENT users go to your site. In other words, if you have fifty users who clicked on you site two hundred times, it will only show 50.
Alright, first things first. Assuming you have windows, right click on your desktop, and make a new text document. Rename the document to "unique.dat". Alright, make another new text document. Now open up your new text document and paste this into it:

CODE

<?php

$filename = "unique.dat";

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

$remote = $_SERVER["REMOTE_ADDR"];
$wholefile = file_get_contents($filename);

  if (preg_match("/$remote/i",$wholefile))
  {
     echo $hits;
  }
  else
  {
     $fd = fopen ($filename , "a+");
     $fout = fwrite ($fd , "$remote\n");
     fclose($fd);
     echo $hits;
  }

?>

Done? Alright, now go back to the desktop, and rename this text document "unique.php". Now upload the two files into your hosting account (whether, it's through cpanel or an ftp application). Set your "unique.dat" to CHMOD 777.

You're done. Now, wherever you want the number to be displayed on your site, place this in the html of your php file:

CODE

<?php include("unique.php"); ?>

It will only display the number so if you want you can also do something like this to display "unique hits = #"

CODE

unique hits = <?php include("unique.php"); ?>


And that's that. I tried to go through step by step, but if you need additional help feel free to ask :D
[post="18728"]<{POST_SNAPBACK}>[/post]



Thats a great code, good work.
[post="18728"]<{POST_SNAPBACK}>[/post]

[/quote]
That's what i was going to say.

Great script... I really appriciate it... i've been using statcounter, though.. good service

Wed Mar 9, 2005    Reply    New Discussion   

Quickly Post to Site Counters - Help Needed  w/o signup Share Info about Site Counters - Help Needed  using Facebook, Twitter etc. email your friend about Site Counters - Help Needed Print
Reply / Comment Ask a Question? Share / Bookmark E-Mail a Friend Print

Php: Allow Or Block Browsers   Php: Allow Or Block Browsers (6) (4) PHP Based Site Access Authentication - Help How to block parts of your web-site ??  PHP Based Site Access Authentication -  Help How to block parts of your web-site ??