PDA

View Full Version : Statistics 1.0 and Download 1.0



stensi
December 8th, 2005, 08:33 PM
EDIT:
As this site has tutorials for PHP I thought this area was suitable for posting Open Source PHP scripts. My apologies if you're wanting pure Flash! These can however be used with Flash.
_______________________________________

Using: PHP

Since this site is also for PHP, I thought I'd bring my other Open Source scripts to everyone's attention. I already posted about Statistics2Flash 1.0 (http://www.kirupa.com/forum/showthread.php?p=1717245).


Statistics 1.0

This is the main script that Statistics2Flash requires as Statistics2Flash is an extension of it that allows the statistics to show in Flash. The statistics this script will manage are:

Users currently online
Users visited today
Users visited yesterday
Total visitor count
These are all unique counts. You have the option of displaying the statistics as text or with images. You can also choose to be notified by email when your total visitor count reaches a "milestone" (ex: you hit 50000).

VIEW DEMO (http://www.simonstenhouse.net/example-statistics.php)

GET SOURCE (http://www.simonstenhouse.net/index.php?area=projects)


Download 1.0

It prevents the leeching of your files, hides the actual location of your files, and logs all downloads as well as leech and hack attempts. You can also use it to show the number of times a file has been downloaded as well as its size (in a user friendly format). Nice and secure!

VIEW DEMO (http://www.simonstenhouse.net/example-download.php)

GET SOURCE (http://www.simonstenhouse.net/index.php?area=projects)


The next script I have in the works is a Web Comic management script. It has a dynamic navigation system (ie. it only shows the "Earliest", "Previous", "Archive", "Next", "Latest" if they're needed) and an archive list. It includes a secure admin area for adding, editing, and deleting your web comics with the ability to have multiple admin accounts.

One thing I'm undecided on, is whether I should bother storing "Author" and "Date Submitted". Most people tend to include those within the web comic image. Your thoughts on whether I should include it?

Following this I'll be recoding my Web Poll script, then a "Time Since" script, and maybe a quick Contact Form.

I hope someone finds these useful! :D


Oh, and after all that I can finally get into finishing some of my Flash games & animations!

tonygarcia
December 8th, 2005, 10:19 PM
cool stuff dude... i really like the stats script.. nice work

treatkor
December 9th, 2005, 04:54 AM
these are really nice. thank you for sharing them.

hybrid101
December 9th, 2005, 08:08 AM
nice code, thanks a lot!

mprzybylski
December 10th, 2005, 02:24 PM
really nice, thanks.

Ravmaster
December 12th, 2005, 02:41 PM
Web Poll script, then a Time Since script, and maybe a quick Contact Form those would be awesome cant w8 :D ;)

simplistik
December 12th, 2005, 02:59 PM
nice stensi

tobijas20
December 13th, 2005, 06:23 AM
Great script and thank you for sharing it!
I have tried Stat1 and Stat2 Flash1 and noticed a problem:

Script doesn't count "online" correctly! It shows "today" as "online".
Example: I load the script (on my domain), close IE, disconnect and connect with different IP. It shows "online = 2". After repeating procedure, it counts 3 etc...

tobijas20
December 13th, 2005, 07:00 AM
After some more tests I have noticed it resets! Than I checked PHP file again and here it is:


$minutes = 15;

Sorry :)

stensi
December 13th, 2005, 05:16 PM
Here's the only spot the $minutes var is used:


// If the user was online within the last 15 minutes...
if ($time < $stored_time + ($minutes * 60))
{
$online++;
}

It's used to help determine which unique IP's were on in the last 15 minutes and increment accordingly.

To clarify, you say you visited the site with one IP, the online counter incremented, and then you visited again with a different IP and it incremented again. It's then safe for me to assume that the second visit you made was within 15 minutes of the first visit since both are still recorded on the count. This means the counters are working as expected :)

Why? The script uses unique IP's for its counts and it will have logged both of those visits and will not remove the first visit from the Online count until 15 minutes has passed without another visit from it. Closing the browser will not clear this so again, you'll have to wait 15 minutes before that first visit no longer shows. If that visitor visits again before that time is up, they'll stay on the count for another 15 minutes.

The Today may have looked to be the same as the Online count but probably only because these were your first recorded visits. The Online count will not include a count of unique IP's that haven't been on the site in the past 15 minutes, whereas the Today count will count all unique IP's having visited that day. So, as the day goes on you'll notice the difference.

Does that clear up your concerns regarding the counters?

As for the reset problem. After reading both your posts again, I've come to the conclusion that 15 minutes later you found the Online count "reset", or in effect, no longer showed the previous visits as they hadn't been on within the "online" time, so all is then as it should be. Did I understand right? :)

tobijas20
December 14th, 2005, 02:57 AM
Yes, that's right! At first I've noticed that the "online" counter doesn't reset. I was 5 times online with different IP in a short period and counter was showing "5 visitors online". But after checking PHP file, I understud the logic :) It was set to 15 min period to check who's still online and who's not.
Great script, I love it!
Thanx !

stensi
December 14th, 2005, 03:25 AM
Cool, no problem :) Happy to hear you like it so much!