Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 05-11-2009
Member
 
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.
Reply With Quote
  #2  
Old 05-11-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
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.
Reply With Quote
  #3  
Old 05-11-2009
medicalseo
 
Posts: n/a
Can anyone please give me n example to explain, how this is done..?
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Can anyone tell me how to code for website views that a website has got?"
Thread Thread Starter Forum Replies Last Post
"Website has sent a certificate with different website name than requested. Accept anyway?" message in Nokia 5800 Kulvir Portable Devices 4 14-02-2012 04:56 AM
How to block website using Website blocker? Edi Windows Software 6 02-07-2011 10:46 PM
Can Any one Help me to Publish a aspx code to website aska121 Technology & Internet 1 18-11-2010 05:07 PM
Norton Safe Web won't verify my Website Tonight website Chang2 Networking & Security 5 17-09-2010 09:47 PM
Dynamic Website VS Static Website Rum Software Development 5 08-01-2010 01:14 PM


All times are GMT +5.5. The time now is 04:39 AM.