Results 1 to 3 of 3

Thread: Can anyone tell me how to code for website views that a website has got?

  1. #1
    Join Date
    Nov 2009
    Posts
    583

    Can anyone tell me how to code for website views that a website has got?

    Hi, i am new to web development, but am looking for a code that would help me determine how many visitors my website got? Can anyone please give me n example to explain, how this is done..? Thanks in advance guys.

  2. #2
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Can anyone tell me how to code for website views that a website has got?

    Well if you are using php, the below code might be very much useful for your purpose;
    Code:
    <?php
    $filename = "hitsnum.txt";
    
    $file = file($filename);
    $file = array_unique($file);
    $numhits = count($file);
    echo $numhits;
    
    $fd = fopen ($filename , "r");
    $fstring = fread ($fd , filesize ($filename));
    fclose($fd);
    $fd = fopen ($filename , "w");
    $fcount = $fstring."\n".getenv("REMOTE_ADDR");
    $fout= fwrite ($fd , $fcount );
    fclose($fd);
    ?>
    save this file as count.php. Now make a new file named numhits.txt and save both the count.php and the numhits.txt. Now upload all the files to the server and CHMOD numhits.txt to 777. After this is done, simply place the following code in your main page;
    Code:
    <?php
    include ('counter.php');
    ?>
    All done.. Now just enjoy your counter. Tell me if you need anything else. Happy to help you.

  3. #3
    medicalseo Guest
    Can anyone please give me n example to explain, how this is done..?

Similar Threads

  1. Replies: 4
    Last Post: 14-02-2012, 04:56 AM
  2. How to block website using Website blocker?
    By Edi in forum Windows Software
    Replies: 6
    Last Post: 02-07-2011, 10:46 PM
  3. Can Any one Help me to Publish a aspx code to website
    By aska121 in forum Technology & Internet
    Replies: 1
    Last Post: 18-11-2010, 05:07 PM
  4. Norton Safe Web won't verify my Website Tonight website
    By Chang2 in forum Networking & Security
    Replies: 5
    Last Post: 17-09-2010, 09:47 PM
  5. Dynamic Website VS Static Website
    By Rum in forum Software Development
    Replies: 5
    Last Post: 08-01-2010, 01:14 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,880,629.19346 seconds with 16 queries