Jump to content
xisto Community
Sign in to follow this  
skpanda

Site Counters - Help Needed

Recommended Posts

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)ORCan how do i design my own (which seems quite....difficult for me)Plz help!!Satya

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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:

<?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:
<?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 = #"
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 ^_^

Share this post


Link to post
Share on other sites

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_SNAPBACK}>

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:

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

Share this post


Link to post
Share on other sites

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_SNAPBACK}>


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/

Share this post


Link to post
Share on other sites

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:

<?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:

<?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 = #"

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_SNAPBACK}>


Thats a great code, good work.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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:

<?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:

<?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 = #"

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_SNAPBACK}>

 

Thats a great code, good work.

<{POST_SNAPBACK}>

That's what i was going to say.

 

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.