Nov 22, 2009
Pages: 1, 2

Site Counters - Help Needed

free web hosting

Read Latest Entries..: (Post #13) by kraizii88z on Mar 9 2005, 03:28 PM.
[quote=ChronicLoser,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...
read more.
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Open Discussion & Free Web Hosting > Computers & Tech > Programming > Scripting > PHP

Site Counters - Help Needed

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

Comment/Reply (w/o sign-up)

firedoor
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

Comment/Reply (w/o sign-up)

szupie
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.

Comment/Reply (w/o sign-up)

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 ^_^

 

 

 


Comment/Reply (w/o sign-up)

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?

Comment/Reply (w/o sign-up)

ChronicLoser
QUOTE (redsox58 @ Feb 18 2005, 08:14 PM)
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?
*

if you're refering to my post...then my answer is I don't know tongue.gif 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 tongue.gif

Comment/Reply (w/o sign-up)

hihihihi88
QUOTE (skpanda @ Feb 19 2005, 05:23 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
*


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/

Comment/Reply (w/o sign-up)

-=Wrighty=-
QUOTE (ChronicLoser @ Feb 19 2005, 04:12 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:
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 happy.gif
*


Thats a great code, good work.

Comment/Reply (w/o sign-up)

SingleDaddyof2
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.

Comment/Reply (w/o sign-up)

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

Comment/Reply (w/o sign-up)

Latest Entries

kraizii88z
[quote=ChronicLoser,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:
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 happy.gif
*

[/quote]

Thats a great code, good work.
*

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

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

Comment/Reply (w/o sign-up)

avalon
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.

Comment/Reply (w/o sign-up)

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

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Pages: 1, 2
Similar Topics

Keywords : site, counters, needed

  1. Coders Needed To Help On A Bulletin Board System (BBS)
    php, mySql, Graphics design work, etc (4)
  2. Basics Of Php For Beginners - Suggestion
    Help Needed For Project (5)
    Hi all, I have a friend who, for his extended IT project is interested in making a website partly
    out of php. When he asked for advice my first thought was here. I would like to know some good
    websites, tutorials etc that he can use to introduce himself to php (he hasn't done much
    before). He is interested in making a simple login/subscription service where you can signup and
    then login to a 'members only' page. Any ideas and code samples that you have to share would
    be greatly appreciated. /tongue.gif" style="vertical-align:middle" emoid=":P" border="0" a....
  3. Should This Great Site Offer Imagemagick ?
    May be the admin of this site think over it. (3)
    Hi As we all know that this website is very good and offering good services. I just wanna know if
    other people also want ImageMagick to be installed on this server with free accounts... so please
    let me know and lets check if the Admin of this site can isntall it..... Fun....
  4. Script For Viewing A Random Image Needed
    (3)
    While browsing the web, I bumped into a script that I could really use, since it's different
    from everything that I saw. Most scripts that view a random image contain a code that chooses an
    image, and then puts the part into the page itself. However, on the www.greenplastic.com web
    site (dedicated to Radiohead), in the top left corner there is a random image module. If you look at
    the code, here's what is used: CODE Now, how can a PHP script be an image, and what
    kind of script that is? If you do visit that URL , you don't get a normal page, b....
  5. Viper Guestbook
    Needed urgently (5)
    Hey all, I need Viper GuestBook, which is a free PHP Script ... When I try to download from
    Hotscript Com it refers me to its website : http://www.vipergb.de.vu/ But the website is
    actually hosted on Lycos, and has been Downtime (Offline) since over 2 months .. I cannot access
    this script /sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> If
    somebody, have access to tis website, and can download the script, than please give me. Or
    otherwise, if u have download the script before (the site getting offline), than please send it to
    me ......
  6. Dynamic Site Design - Where Do I Start ?
    (7)
    I am new to php. I have some programing background in html, javascript, and c++ but have never done
    anything in php Can someone reccomend some good sites or books etc that can help someone who is
    completely new? My ultimate goal is to make a game like/similar to ponyisland.net....
  7. Need Help Is Adding A PHP Based News Module To My Site
    (2)
    Hey guys i need a simple help i'm builing a homesite and i have a little spot for news. Well i
    just place there the Topics and add a link to another page "news.php". Well its obvious that i dont
    want to build a file for each news that i have so i know that exists a way to work with SQL & PHP. I
    will show want i'm doing CODE        require ('mysql.php');       
    $query="SELECT * FROM News ORDER BY `data` ASC LIMIT 0,5 ";        $result=mysql_query($query);
               $num=mysql_num_rows($result); mysql_close(); echo " Outras Other News "; $i=....
  8. Multilingual Site: Send The User To Page Of Choice
    (6)
    If you have one site in diferent laanguages, this simple script can redirect the user to the correct
    page acording to his/her language: CODE // Enslish EUA elseif ($HTTP_ACCEPT_LANGUAGE ==
    "en-us"){ header("Location: index_eng.html"); } // Inglęs UK elseif ($HTTP_ACCEPT_LANGUAGE ==
    "en-gb"){ header("Location: ingles_enuk.html"); } // Portuguese if ($HTTP_ACCEPT_LANGUAGE ==
    "pt-br"){ header("Location: index_ptbr.html"); } //German elseif ($HTTP_ACCEPT_LANGUAGE ==
    "de-de"){ header("Location: index_ger.html"); } // Swedish elseif ($HTTP_ACCEPT....
  9. How Do I Make PHP Based Image Gallery Like This?
    Help Needed (20)
    is it possible to make a page in php, with a url like this:
    httq://www.mysite.com/viewer.php?http://www.mysite.com/galleries/01 (This is a sample link, read
    below) so that in what i change the last part the gallery will change with it? so that i just have
    to make one php-page and this page just shows all the imaes in the map thats in the url after the
    questionmark?? thanks,....
  10. Using Bitflags To Restrict Site/page Permissions
    (1)
    My professor is designing a website that uses bit-flag checking to allow access to certain pages.
    You login, validate login, and store their allowed bit flag into a session variable. Then you
    compare to see if they have access or not. It's fairly new to me, but it's apparently very
    common with linux users. Sounds interesting to me, just wondering if any one has used this, or is
    it a little too much for simple pages. His site however is going to be more of "software" for
    several users. Is it very secure and does it work well?....
  11. Saving A Php Generated Image To The Server
    Help Needed Please (5)
    I'm trying to create a script that will generate an image and send it back to the browser while
    saving the same image to the server. I'm doing this because the image should be dynamically
    generated but because of the load that would place on a server if the image happened to be requested
    frequently, I've decided to build in a means to serve the static version of the image most of
    the time. What isn't included here is the function that will check the age of the file in cache
    directory and serve the static image if it is less than an hour old. This isn....
  12. Php: Write Random Text As Image
    Having problems, help needed! (3)
    I'm trying to create a script that writes text to an image. CODE header("Content-type:
    image/png"); $_phrases = array( "Test 1", "Test 2", "Test 3", "Test 4", "etc." );
    $_rand_phrase = $_phrases ; $_image = imagecreatefrompng("gmail.png"); $_user_width =
    imaagettfbbox(9,0,"tahoma.ttf",$_rand_phrase); $_x_value = (200-($user_width + 113)); $_color =
    imagecolorallocate($_image, 165, 164, 164); imagettftext($_image, 9, 0, $_x_value, 16, $_color,
    "tahoma.ttf", $_rand_phrase); imagepng($_image); imagedestroy($_image); I can't see what
    I'm doing w....
  13. How To Use Cookie In Your Web Site ?
    this semple code to use and get cookie (1)
    what is the cookie ? the cookis it is some info sent and save in user computer whare i can use the
    cookies? becouse the cookies it like the header you can not send it after any output wes sent so
    you must send the cookies before any output like as ,echo and any other code i well make an E.X.
    to use the cookies you must have 2 file index.php update.php ---------- in the index.php add this
    code CODE    // This section must go at the top of the page that will display    // the
    users favorites.  These are the 'default' URLs that the user    // will se....
  14. Do You Want A Mail Form In Your Site
    (2)
    Notice from m^e: Repeat post. Credits reduced by 5 days. Learn to USE
    THE SEARCH BUTTON before you make such posts. did you want to have in your web site mail form
    that allow the user to send mails to anther mail from his mail e.g. the compose in yahoo CODE
    from to cc bcc subject
    function param($Name)         {         global
    $HTTP_POST_VARS;         if(isset($HTTP_POST_VARS ))            return($H....
  15. Own Links On Site
    (6)
    I'm thinking of having some kind of system so the users can register and then put up their
    links. Everything should be saved in some kind of database. Anyone now any tutorial or guide or
    something like that of how to do that?....
  16. PHP Based Site Access Authentication - Help
    How to block parts of your web-site ?? (4)
    How can i program my web page using php that when the value of the login box is equal to some string
    then go to my success.html otherwise on my fail.html????help me guys!
    ------------------------------------ It would help the readers far better to understand what your
    problem is - if you state the nature of it in short in your topic title, instead of just "Php help".
    It'll also get you a lot more responses. Am changing your topic title to give you an example.
    All the best /smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> m^e....
  17. Php Script To Download File From Another Site
    (11)
    hi i need a php or java script code for downloading files from other sites to my site for example:
    http://download.com/file.zip to http://mysite.com/file.zip thanks....
  18. Help With Some Php Or Maybe Asp
    help needed (5)
    Hi Too all first of all I want to say I need 10 posts badly so lets help each other lol! Ok and now
    the real part I need some help with php because Im pretty new to it (really im not a big fan of php
    I like asp more but as asp is an Microsoft protuct its not cheap so have to start liking PHP
    /laugh.gif" style="vertical-align:middle" emoid=":lol:" border="0" alt="laugh.gif" /> ) I need too
    include a part of one site in my site that meens i dont need the whole site onlia a smal part. I
    found the way but it loads very slow so im trying to find an other way. Heres the cod....
  19. How Do U Make Members Only Web-site
    (7)
    how do u make it that only a member of that site can view that page?....

    1. Looking for site, counters, needed

See Also,

*SIMILAR VIDEOS*
Searching Video's for site, counters, needed
advertisement



Site Counters - Help Needed

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com