Jump to content



Welcome to AstaHost - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!

Toggle shoutbox Shoutbox Open the Shoutbox in a popup

@  agyat : (24 May 2013 - 05:15 PM) O Dear, Where Are You? Without Your Words This Sb Is ..
@  agyat : (23 May 2013 - 01:23 AM) Wow! Mr. Sb Back Home.
@  OpaQue : (23 May 2013 - 12:44 AM) Ting
@  OpaQue : (24 April 2013 - 02:44 PM) I guess, Time to run Mycent script.
@  OpaQue : (24 April 2013 - 02:43 PM) wow.. not much spam. except habatt posting lot of links.. :P
@  yordan : (23 April 2013 - 01:04 PM) You're welcome, agyat. Nice to have been helpful. Second lesson: try full words, "you" instead of "EW".
@  agyat : (23 April 2013 - 05:03 AM) @YORDAN: tHANK EW FOR YOUR FIRST LESSON.   :D
@  yordan : (22 April 2013 - 09:43 PM) @agyat : "why don't you help me", or "please help me", or "please teach us"
@  yordan : (22 April 2013 - 09:42 PM) welcome back, velma
@  velma : (22 April 2013 - 07:51 AM) **yawns** Good to be back, wonder what is going on here :)
@  agyat : (22 April 2013 - 03:50 AM) Oh! so, why don't help me learn english..
@  yordan : (21 April 2013 - 08:38 PM) The goal mentioned by shiu : "learning english, learning computer"
@  agyat : (21 April 2013 - 06:31 PM) WHAT GOAL?
@  yordan : (20 April 2013 - 10:39 AM) yes, that's our goal. simultaneouly learning English and teaching/learning computer using.
@  shiyu : (20 April 2013 - 07:30 AM) learning english,learning computer
@  yordan : (19 April 2013 - 01:11 PM) Oh, I see, it's just a trick in order to force people looking at your texte. Somehow smart, maybe.
@  agyat : (19 April 2013 - 02:54 AM) And of course I know it is not SEO friendly.
@  agyat : (19 April 2013 - 02:52 AM) There may be two possible answers for that ....


1) Shout was posted using mobile keypad.

2) To force people read content carefully and/or with more concentration.
@  agyat : (19 April 2013 - 02:49 AM) There may be two possible answers for that ....
@  yordan : (18 April 2013 - 09:35 PM) however, why this mixing of capital letters in the middle of your text?

Replying to Site Counters - Help Needed


Post Options

    • Can't make it out? Click here to generate a new image

  or Cancel


Topic Summary

kraizii88z

Posted 09 March 2005 - 03:28 PM

[quote name='ChronicLoser' date='Feb 18 2005, 08:12 PM']
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}>

[/quote]

Thats a great code, good work.

<{POST_SNAPBACK}>

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

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

avalon

Posted 22 February 2005 - 06:44 PM

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.

miCRoSCoPiC^eaRthLinG

Posted 22 February 2005 - 05:02 PM

This deals mostly with php scripting of counters. So moved to Programming > Scripting
---------
m^e

harriko

Posted 20 February 2005 - 07:07 PM

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!

skpanda

Posted 20 February 2005 - 12:20 PM

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!!

SingleDaddyof2

Posted 19 February 2005 - 12:25 PM

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.

-=Wrighty=-

Posted 19 February 2005 - 11:54 AM

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.

hihihihi88

Posted 19 February 2005 - 09:16 AM

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/

ChronicLoser

Posted 19 February 2005 - 06:12 AM

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

redsox58

Posted 19 February 2005 - 03:14 AM

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?

Review the complete topic (launches new window)