websaint 0 Report post Posted September 28, 2004 (edited) Hi!! I'm going to show you how to make your own counter useing php!! It's really easy and you woun't have to keep seaching the net for free and bannerless counters.So here comes the script: <?php //Simple class for counting visits //Written by WebSaint class Teller { function count() { $countfile = file("alle.txt"); $count = $countfile[0]; $count= $count + 1; $fp = fopen("alle.txt","w"); $fw = fwrite($fp,$count); fclose($fp); echo $count; } } $obj =& new Teller; $obj->count(); ?>Then add this to display the number of visitors:<p>Number of guests visiting my site: <? include('alle.txt'); ?>.</p> That's it. I hope you'll find the script useful! Edited January 27, 2006 by miCRoSCoPiC^eaRthLinG (see edit history) Share this post Link to post Share on other sites
qwijibow 0 Report post Posted September 29, 2004 Good... but you might find others steal your counter if they find it...they will link to your counter script, and store their page cound on your server.its always good to add some kind of proetection againsed this. a good, but not perfect way is to make sure the referer comes from your own site, and nobody elses. Share this post Link to post Share on other sites
Hercco 0 Report post Posted September 29, 2004 Good... but you might find others steal your counter if they find it... they will link to your counter script, and store their page cound on your server. its always good to add some kind of proetection againsed this. a good, but not perfect way is to make sure the referer comes from your own site, and nobody elses. <{POST_SNAPBACK}> Well it's impossible to "steal" this. If you include that file from Websaints server the code will be treated as it was run on your server and thus will try to look file alle.txt from your server. If you simply request that file it will only add hits to Websaints counter. The referer checking would be pointless in this but I'd like comment it a bit in general. People do not seem to know or just forget that nowadays quite many users disable or block referer sending. In certain browsers it is an option and I believe most of the current commercial software firewalls include an option to block them. Not taking this into account can mean that users that do not want to send referers can't use the service at all. For instance one development version of the WordPress blog software required referer sending to make changing it's options possible. The referer checking was simply just for sending the user back to the page where he came from. Other example is a certain torrent site that refuses to work if not getting referer information. They reason is understandable though: there is apparently countless "mirror" sites that are not actual mirrors but simply index their files and points the user to download the .torrents from the original site. Share this post Link to post Share on other sites
qwijibow 0 Report post Posted September 30, 2004 Well it's impossible to "steal" this. If you include that file from Websaints server the code will be treated as it was run on your server and thus will try to look file alle.txt from your server. If you simply request that file it will only add hits to Websaints counter. The referer checking would be pointless in this but I'd like comment it a bit in general. People do not seem to know or just forget that nowadays quite many users disable or block referer sending. In certain browsers it is an option and I believe most of the current commercial software firewalls include an option to block them. Not taking this into account can mean that users that do not want to send referers can't use the service at all. For instance one development version of the WordPress blog software required referer sending to make changing it's options possible. The referer checking was simply just for sending the user back to the page where he came from. Other example is a certain torrent site that refuses to work if not getting referer information. They reason is understandable though: there is apparently countless "mirror" sites that are not actual mirrors but simply index their files and points the user to download the .torrents from the original site. <{POST_SNAPBACK}> you misunder stand my meaning....... i mean someone could replace <p>Number of guests visiting my site: <? include('alle.txt'); ?>.</p> the include file with a coomplete URL to anouther server. and replace "alle.txt" with a different filename. Share this post Link to post Share on other sites
k221405241470 0 Report post Posted September 30, 2004 But if you substitute the .txt file with a php file is't better?like this <?php<?php$now=fopen("count.php","r+");while(!feof($now)){ $cont=fgets($now,2); if ($cont=="N") { $check=fgets($now,3); if($check=="V=") { $nvisit=fgets($now,4); echo $nvisit; settype($nvisit,"integer"); $posi=ftell($now); fseek($now,($posi-2)); fwrite($now,($nvisit+1)); exit; }}}fclose($now);?>and a count.php like this<?phpNV=34?> Share this post Link to post Share on other sites
sha1405241471 0 Report post Posted October 4, 2004 there are many scripting languages and you can find counter in each. first check which scripting is available on your server and then try to find its script for counter. i reccomond altavista.com rather than google.com for finding free scripts. Share this post Link to post Share on other sites
Hercco 0 Report post Posted October 4, 2004 <p>Number of guests visiting my site: <? include('alle.txt'); ?>.</p>the include file with a coomplete URL to anouther server. and replace "alle.txt" with a different filename. <{POST_SNAPBACK}> And that would accomplish what? there are many scripting languages and you can find counter in each. first check which scripting is available on your server and then try to find its script for counter. i reccomond altavista.com rather than google.com for finding free scripts. <{POST_SNAPBACK}> We're DYI guys, we want to write our own scripts Share this post Link to post Share on other sites
deivid1405241470 0 Report post Posted October 4, 2004 Why search or write you own counter ? if you want an easy way and a ads-less counter, just go to your Xisto control panel, under Preinstalled Scripts / CGI Center / Counter, you can choose between 35 diferent types of counters and configure almost anything. After you choose your desired counter, press preview to see it how it's going to be and if you like, press make html and it will write a code to insert in your page.Greets Deivid Share this post Link to post Share on other sites
antitoxic 0 Report post Posted October 4, 2004 Why don't you use a beautiful flash counter connected with a php code. An example can be downloaded from flashkit.com tutorials. Share this post Link to post Share on other sites
sohahm 0 Report post Posted October 6, 2004 I know a very good free script named EliteStats.You just have to put its folder in your main directory and include a one line of code in your webpage.It will display How many visitors are online and complete statistics with IP address.Sohail Ahmedsohail4@msn.com Share this post Link to post Share on other sites
jcguy 0 Report post Posted October 8, 2004 I personally use and would highly recommend Statcounter, a free counter tracking service. It's so much more powerful than other free counters with its advanced visitor reporting and more. Share this post Link to post Share on other sites
Darren1405241470 0 Report post Posted October 13, 2004 As I said in the other Forum I have also used statcounter and suggest you at least try it. It is ad free and u have the option to make it invisible or give it a range of colours. You can also with the one acount use it for multiple sitesand pages. Share this post Link to post Share on other sites
thedevil 0 Report post Posted November 18, 2004 ok I use the Mysql database to store the counter results. coz i have a database maintained already for the site... the code is simple just fetch the row with the counter...and use echo display on the page...why bother about the security... The data base is secured... Share this post Link to post Share on other sites
yordan 10 Report post Posted September 7, 2005 @Darren : seems to be interesting from what you say. I will give statcounter a try, and will compare to Xisto's one. The one from Xisto is also really impressive, I like it. Besides that I forgot my statcounter's password, and I am still waiting for the mail with it.YordanOK, Darren, your are right, statcounter is really great. Their counters are not so nice as Xisto ones, and the menus to step inside are not really easy to understand, and I experienced several disconnections in the middle of the process of creationg your counter. But if you want something really simple, without any ads, it's a simple line to be included inside your html source. And it works anywhere, including on your own PC for testing purposes, which is not the case for the Xisto counter.So, if you want something easy to implement, very nice, with a comfortable menu-diriven settings, use Xisto's cpanel one. If you want something simple, which works on any site including your PC, use statcounter. Share this post Link to post Share on other sites
GameUltra 0 Report post Posted September 7, 2005 Not too bad, it's a pretty simple counter, but it get's the job done.I've been trying to figure out this one though, how do we make a download counter, that one is a bit harder isn't it? I suppose we'd make a page that would open the file's URL in a redirect, but also add to the counter and direct them to that instead of the counter? Share this post Link to post Share on other sites