PDA

View Full Version : Help editing a simple PHP script


bluemicrobyte
11-10-2005, 7:53 PM
UPDATE: A solution has been found! The following PHP script with modifications to the flash file will display the number of unique visitors from the second script mentioned below.

<?php
$file_count = fopen('count.db', 'rb');
$data = '';
while (!feof($file_count)) $data .= fread($file_count, 4096);
fclose($file_count);
list($today, $yesterday, $total, $date, $days) = split("%", $data);
echo "c=".$total."";
?>

Is it possible to modify this script so that if $total equals to 12 the script will output c=000012 instead of c=12 so that there are at least 6 digits?

---------------------------old post-------------------------------


I found a very simple visitor counter PHP script.

Download: http://www.nweb.ch/scripts/
(click here for direct download link (http://www.nweb.ch/scripts/flash_live_counter/live_counter.zip))

UPDATE: An alternative to editing this PHP script (which people have told me will be ugly if anyone tries to do it) is to modify the flash file that displays the number of hits so that instead of getting the number from this script it gets the number from the text file of another script -- see the "PS" in the post below this. I do not know how to modify the flash file, but if you think you can please help.

I've modified the flash file to fit my site (http://bluemicrobyte.kupatrix.org/Microbyte_Productions/index.html), but currently the counter counts every time the page is refreshed. Does someone know how to edit the count.php file so that the counter only increases for each unique IP address that visits my page? (visitors returning after 24 hours would be counted as new visitors)

bluemicrobyte
11-27-2005, 3:58 AM
I have another script that needs editing :P

code:
http://www.artworld.si/simple_php_unique_hit_counter-tutorial-235.art

example of code / what i have set up:
http://bluemicrobyte.kupatrix.org/Microbyte_Productions/stats.php

Is it possible to modify the script and display table to include a "returning visitors" section that counts visitors with a previously logged IP that have not visited within a given number of hours? (24 hours).

update: it would be just as good if the ip.db file reset once every 24 hours regardless of individual IPs

PS: an alternative to editing the above script is to edit the flash file that displays the hits so that the flash file displays the number of visitors from THIS scripts text file that keeps count. This may be easier.
update: this has been done.

Fenguin
11-27-2005, 5:01 PM
Do you have access to an SQL database?

bluemicrobyte
11-27-2005, 6:22 PM
MySQL, but I would prefer to do it without a database. (but doing it with a database is beter than not doing it at all)


UPDATE: see above posts