sidwndr Posted January 30, 2003 Share Posted January 30, 2003 I'm looking for a few good hit counters for my site. I'm not after the whole web stat think, just a counter. But I'm having problems finding any. Help Please!! Link to comment Share on other sites More sharing options...
0 NetRyder Posted January 30, 2003 Share Posted January 30, 2003 Try http://www.infinitefx.co.uk Link to comment Share on other sites More sharing options...
0 sidwndr Posted January 31, 2003 Author Share Posted January 31, 2003 Nice, but not exactly what I had in mind. :no: Link to comment Share on other sites More sharing options...
0 Clone5k Posted February 1, 2003 Share Posted February 1, 2003 You could program your own :D Link to comment Share on other sites More sharing options...
0 sidwndr Posted February 1, 2003 Author Share Posted February 1, 2003 I have no idea how to program my own hitcounter. Help would be appreciated. Link to comment Share on other sites More sharing options...
0 BxBoy Posted February 1, 2003 Share Posted February 1, 2003 what language do you want it in? Link to comment Share on other sites More sharing options...
0 sidwndr Posted February 3, 2003 Author Share Posted February 3, 2003 HTML would be the language I need. Thanks in advance Link to comment Share on other sites More sharing options...
0 Rathamon Posted February 8, 2003 Share Posted February 8, 2003 hmm , you cant do it in HTML since HTML cant remember numbers :s Link to comment Share on other sites More sharing options...
0 sethrd Posted February 8, 2003 Share Posted February 8, 2003 Go to Spoono and use their PHP tutorial on how to make one. Link to comment Share on other sites More sharing options...
0 nacs Posted February 8, 2003 Share Posted February 8, 2003 Here's PHP counters: http://www.hotscripts.com/PHP/Scripts_and_...grams/Counters/ They also have counters in other languages if you wish. Link to comment Share on other sites More sharing options...
0 mr_daemon Posted February 10, 2003 Share Posted February 10, 2003 My quick CheesyHitCounter was written in 10 minutes in order to quickly gather the average amount of hits. Here's the source code. <?php /* PHP CheesyHitCounter v1 Copyright (c) Alexandre Gauthier for Paris Glove of Canada Ltd NOTE: Some of the variables have been stripped because the local PHP system would not like them. I have no clue why. Stay away from my code, filthy demonic jscript! /**************************************************/ // Declare basic database variables $database_host = "yourhost"; // Host $database_user = "yourusername"; // Username $database_password = "yourpassword"; // Password $database = "yourdbname"; // Database Name $table_name = "yourtablename"; // Table Name // Variables used to connect to Database Backend $connect = mysql_connect($database_host,$database_user,$database_password) or die("Unable to connect to Database Backend -- Please advise admin@parisglove.com."); $db = mysql_select_db($database,$connect) or die("Unable to select database because an error occured."); //I dunno. I'm lazy for errs anyways. /* Add a hit to our counter */ function hitcountAdd() { // Get current counter value from database $query_getCounterValue = "SELECT num_hits_value FROM c_hit_counter"; $query_result = mysql_query($query_getCounterValue); while ($counter_array = mysql_fetch_array($query_result)){ $counterValue = $counter_array[num_hits_value]; } // Add 1 to counterValue $counterValue++; // echo $counterValue; // For debugging purposes, show me what you got. // Insert new value into Database Backend $query_updateCounterValue = "UPDATE c_hit_counter SET num_hits_value='$counterValue'"; mysql_query($query_updateCounterValue); // Done. Lather, rinse, repeat. } // Display the amount of hits function displayHits() { //Retrieve the value from the database $query_getCounterValue = "SELECT num_hits_value FROM c_hit_counter"; $counter_tmp = mysql_query($query_getCounterValue) or die("Unable to retrieve counter value from Database Backend."); while($counter_array=mysql_fetch_array($counter_tmp)) { $counterValue=$counter_array[num_hits_value]; } echo ($counterValue); // Display it return($counterValue); // In case you'd like to do something else with it. } // You should call this all-in-one function. function hitCounter() { // Adds a hit and then return displayHits hitcountAdd(); $programOutput = displayHits(); return($programOutput); } ?> Link to comment Share on other sites More sharing options...
0 Rusty.Metal Posted February 10, 2003 Share Posted February 10, 2003 1) Put this where u want the counter <php include("counter.php") ?> 2)Make a file "counter.php" (make it in notepad is fine) put this in it <?php $filename= "hits.txt"; $fd = fopen ($filename , "r") or die (" cant open $filename have u chmoded $filename to 777"); $fstring = fread ($fd , filesize ($filename)); echo "$fstring"; fclose($fd); $fd = fopen ($filename , "w") or die ("cant open $filename have u chmoded $filename to 777"); $fcounted = $fstring + 1; $fout= fwrite ($fd , $fcounted ); fclose($fd); ?> 3) create a file "hits.txt" CHMOD it to 777 (allows the script to write to it) Link to comment Share on other sites More sharing options...
0 sphere Posted February 10, 2003 Share Posted February 10, 2003 ok aaronsam, so i've put the bit of code in my website (just on some line), then i've created counter.php. Then i uploaded them to the same dir on the net. I also made hits.txt, but what is chmoded? and how do i do it? And then do i upload that to the same place? Link to comment Share on other sites More sharing options...
0 Rusty.Metal Posted February 10, 2003 Share Posted February 10, 2003 CHMOD is setting the access to the file i use cute ftp, i right click, then CHMOD Link to comment Share on other sites More sharing options...
0 sphere Posted February 10, 2003 Share Posted February 10, 2003 ah, i see. thanks :) Link to comment Share on other sites More sharing options...
Question
sidwndr
I'm looking for a few good hit counters for my site. I'm not after the whole web stat think, just a counter. But I'm having problems finding any. Help Please!!
Link to comment
Share on other sites
14 answers to this question
Recommended Posts