This page is for passing around ideas for the different scripts and programs that will go into making this project a reality. The page, Stats/ua script is for writing and discussing the actual code... (This is for theory, that is for practice)
The following is a diagram of how a user-tracking script would work on a remote website... Please remember that we want to make this as portable to as many different platforms as possible, so writing this in PHP, ASP, and any other server-side language as possible will be extremely helpful. Also, the functions to connect to, read from, and write to databases should cover as many different database types as possible, include a raw text file for those who don't want to use a database.
Obviously, we will also need an installation script, which I'll cover later.
Commentary: The script obviously enters at the top ;-), then is faced with a choice as to whether or not this will be an administrative session or not. (Admin session would be for changing options, displaying stats, etc.) The easiest way to do this would be to use an HTTP GET request, for instance, "myscript.php?admin=yes". If we are counting stats, however, we should then check if the user has visited the site recently, probably by checking the IP to a list of recent IPs... This would imply opening and reading the database before this step... I'll have to update this image to reflect this revelation. :-P
Anyways, as we continue, if the user doesn't have an existing session, then we'll get their user agent string, sort the relevant information out of it, and store their information... Along the way, we'll also check our database to see if we have enough records to send up to our central bean-counting server for final processing and display on our web page.
I really hope that this gets MUCH more involved as we add different options to the above script... The installation is the key to making the script as cross-platform compliant as possible.
Functions Needed Edit
We will need the following functions for the stat tracker:
- Display Administrative Page (Mostly echo HTML)
- Possible Login
- Show stats, either raw or graphical
- Allow to change settings, such as database connection info and site name
- Open Database, Select from, and update
- As many DB types as possible (We have MySQL)
- Send stored records
- via Email
- via RSS?
- via HTTP POST request? (might require more than just scripting)
Following functions for installation script:
- Optimize stat tracking script
- remove database types that were not selected
- remove password sub-page for admins who are alright with stats being public
- etc... in other words, we're completely re-writing a custom stat tracking script
- Set up database fields
- Confirmation web page (again, just echoing HTML... I can make it work, but I'm not that great at making it look professional)
Existing Functions Edit
We already have these functions available for the stat tracker using PHP... Everyone is still welcome to post these functions using different server-side languages.
- Determine User_Agent
- Thank you, Kincera
- DB Connect to MySQL
- Thank you, Kincera
- Write to plaintext file
- Optional image passing function
- For those who can't/won't include the stat tracker in their page's scripts