Webmaster Forum  

Go Back   Webmaster Forum > Marketing, SEO and Development > Programming
User Name
Password
Register FAQ Members List Calendar Transactions Store Search Today's Posts Mark Forums Read


Hit counter

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-17-2006, 00:08
Positive
Senior Member

Positive's Avatar

Join Date: Mar 2005
Posts: 2,565
Trader Rating: (4)
Points: 15 (Donate)
5 F$/Referral Refer Friends
Positive is on a distinguished road
Default Hit counter

Is there any script which I can place on my site to work as hit counter? I mean it shouldn't use any other site's resources like bravenet etc.
Positive is offline
Reply With Quote
  #2  
Old 11-17-2006, 13:04
mtorregiani
Senior Member

mtorregiani's Avatar

Join Date: Oct 2006
Posts: 236
Trader Rating: (0)
Points: 26 (Donate)
5 F$/Referral Refer Friends
mtorregiani is on a distinguished road
Default Re: Hit counter

mtorregiani is offline
Reply With Quote
  #3  
Old 11-17-2006, 13:17
forumposters
Senior Member


Join Date: Jun 2006
Location: Calpines
Posts: 100
Trader Rating: (0)
Points: 38 (Donate)
5 F$/Referral Refer Friends
forumposters is on a distinguished road
Default Re: Hit counter

Does that one require a backlink?
__________________
Forum Posters
forumposters is offline
Reply With Quote
  #4  
Old 11-17-2006, 15:44
Borghunter
Junior Member


Join Date: Nov 2006
Posts: 1
Trader Rating: (0)
Points: 0 (Donate)
5 F$/Referral Refer Friends
Borghunter is on a distinguished road
Cool Re: Hit counter

Here's one that I use:

Create a counter.class.php file and insert this:
PHP Code:
 class Counter
{
    var 
$counter_file '';

    function 
Counter($counter_file 'counter.txt')
    {
        if (!
file_exists($counter_file)) {
            
touch($counter_file);
        }

        
$this->counter_file $counter_file;
    }

    function 
increment($my_identifier)
    {
        
$my_identifier str_replace(' ''_'$my_identifier);

        
$file file($this->counter_file);
        foreach (
$file as $index => $line) {
            list(
$identifier$count) = explode(' '$line);

            if (
$identifier == $my_identifier) {
                
$new_count $count 1;
                
$file[$index] = $identifier.' '.$new_count."\n";
                break;
            }
        }

        if (!isset(
$new_count)) {
            
$new_count 1;
            
$file[] = $my_identifier.' '.$new_count."\n";
        }

        
$fh = @fopen($this->counter_file'w');
        if (
$fh === false) {
            return 
false;
        }

        
$bytes fwrite($fhimplode(''$file));
        
fclose($fh);

        if (
$bytes === false) {
            return 
false;
        }

        return 
$new_count;
    }

    function 
getCount($my_identifier)
    {
        
$my_identifier str_replace(' ''_'$my_identifier);

        
$fh = @fopen($this->counter_file'r');
        if (
$fh === false) {
            return 
false;
        }

        while (!
feof($fh)) {
            
$buffer fgets($fh);
            list(
$identifier$count) = explode(' '$buffer);

            if (
$identifier == $my_identifier) {
                
fclose($fh);
                return (int) 
$count;
            }
        }

        
fclose($fh);
        return 
0;
    }



Sample Usage:

Create a count.txt file

Initialise the counter like so:
PHP Code:
 $count_my_page = ("count.txt");
$hits file($count_my_page);
$hits[0] ++;
$fp fopen($count_my_page "w");
fputs($fp "$hits[0]");
fclose($fp);
echo 
$hits[0]; 

Hope this helps
Borghunter is offline
Reply With Quote
  #5  
Old 11-19-2006, 22:30
infinitomagazine
Senior Member


Join Date: Oct 2005
Location: peru-south america
Posts: 983
Trader Rating: (0)
Points: 49 (Donate)
5 F$/Referral Refer Friends
infinitomagazine is on a distinguished road
Send a message via MSN to infinitomagazine
Default Re: Hit counter

nice script, I will try to install those scripts and know how its works
__________________
TRIBALHOST.NET - Realiable and Cheap Shoutcast Hosting
50 slots $10 dollars month
100 slots $20 dollars month
infinitomagazine is offline
Reply With Quote
  #6  
Old 11-25-2006, 19:58
Magical
Junior Member


Join Date: Nov 2006
Posts: 10
Trader Rating: (0)
Points: 6 (Donate)
5 F$/Referral Refer Friends
Magical is on a distinguished road
Default Re: Hit counter

Thanks guys. I think it does require a backlink
Magical is offline
Reply With Quote
  #7  
Old 12-04-2006, 09:38
Jpuura
Junior Member


Join Date: Dec 2006
Posts: 5
Trader Rating: (0)
Points: 5 (Donate)
5 F$/Referral Refer Friends
Jpuura is on a distinguished road
Default Re: Hit counter

nice counter
Jpuura is offline
Reply With Quote
  #8  
Old 12-05-2006, 14:53
Noner
Senior Member


Join Date: May 2006
Posts: 169
Trader Rating: (0)
Points: 7 (Donate)
5 F$/Referral Refer Friends
Noner is on a distinguished road
Default Re: Hit counter

Is there any hit counters, that doesn't need link? One would really be usefull as they are really usefull for some sites. I am currently just using AWSTATS, from cpanel.
Noner is offline
Reply With Quote
  #9  
Old 12-06-2006, 02:03
1syntax
Junior Member


Join Date: Dec 2006
Posts: 10
Trader Rating: (0)
Points: 8 (Donate)
5 F$/Referral Refer Friends
1syntax is on a distinguished road
Default Re: Hit counter

Thanks you guys, gonna try that script out and see what happens ^^
1syntax is offline
Reply With Quote
  #10  
Old 12-16-2006, 12:41
BoxedHosting
Junior Member


Join Date: Dec 2006
Posts: 24
Trader Rating: (0)
Points: 15 (Donate)
5 F$/Referral Refer Friends
BoxedHosting is on a distinguished road
Default Re: Hit counter

yeah if you have cpanel, awstats is the best. There are scripts you can use to even access it without having to login to cpanel
BoxedHosting is offline
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Resources : | Advertise at FHF | itextLink.com| Reseller Hosting| TextDot| iNamePros| Any Webmaster| Web Host| Dep3| cheap low cost web hosting reviews|


All times are GMT -4. The time now is 06:28.


Powered by: vBulletin
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.