nucleoStats

Script last updated on May 26, 2007 3:33pm by !nucleo.

Here it is, the long anticipated nucleoStats program. This is version 0.1 and is *NOT COMPLETED*. The script works fine as my site has been using it for a while. You can download the script here

I will now paste the readme/instructions file which is included in the zip file. It looks like hell but I'm kinda in a hurry. The instructions will be made easier in the next release.

# NucleoStats version 0.1
# www.nucleocide.net/nucleoStats.htm
# nucleocide@gmail.com
# This script is released under the GNU GPL.
# Feel free to redistribute and modify code but you must leave
# this disclaimer intact.

The first thing you need to know is that this script is version 0.1. This means that it is not done
yet. The script works fine and I'm running it on a production site however it is not user friendly
and some features still need to be added. If you don't know at least some PHP you will most likely
be lost. Now that that is out of the way, have fun with the code and email me if you must.

Steps until you complete the script installation:
1. Execute the MySQL commands included in 'nucleoStats.sql'
2. Modify the file 'userinfo.php' to reflect your setup
3. Upload the PHP files to your server
4. Send the page hit string to the PHP function add_hit()
5. View the administration file
6. Appendix (Optional stuff for spiffy integration)

## STEP 1 ##
The first step is to execute the MySQL commands to build the tables. These are contained in a
phpMyAdmin SQL dump file included with this zip file. The filename is nucleoStats.sql. This file
contains a few browsers and OS's, along with an example of your very first hit. The easiest way to
run these commands is to import them into your phpMyAdmin install. (If you are using shared hosting
and cPanel, this *Should* be available to you).
*Note*, this script doesn't include table prefixes as of yet so make sure you aren't going to overwrite
anything important. If your not sure, you either shouldn't be installing this script or at the very
least make a backup.

## STEP 2 ##
Open the file 'userinfo.php' and locate the following lines (These are located near the top):
$mySqlServer = 'localhost';        #SERVER
$mySqlUser = 'nucleocidepwnz';    #USER
$mySqlPass = 'supersecretpass';    #PASS
$mySqlDB = 'mydatabaserox0rz';    #DATABASE
Each of the four lines will need to be changed to reflect your MySQL connection. If your like me and
can make several databases, I would reccomend making one specifically for the stats program. Just a thought.

## STEP 3 ##
Using your favorite FTP program (or least favorite) upload the two files 'userinfo.php' and 'userinfoadmin.php'
to your site. It doesn't really matter where you put them as long as they are in the same directory.

## STEP 4 ##
The installation is now complete. But, it's useless unless you send it new hits. In order to do this, you will
need to put together a string which represents the page being viewed. A few good examples would be 'news',
'portfolio', 'gallery', etc. The best advice I have would be to keep the names simple. Here are a few examples
of how to devise your page string:
I use a system like "index.php?section=news". So, my string would be calculated using the variable $string = $_GET['section']
Some people aren't cool and use static files. For this your string could be taken from the filename using this:
$temp = explode(".",basename($_SERVER['SCRIPT_FILENAME']));
$string = $temp[0];
There are many other ways to do this, especially if you are integrating this into a content management system or
other pre-existing script.
Once you've gotten your string, first include the userinfo.php page with
include("userinfo.php");
then execute the line
add_hit($string);
once in your page and your done. Hit has been added.

## STEP 5 ##
To view the statistics for your site, open the userinfoadmin.php file from a web browser. This will
show you all of the graphs and various statistics collected. In order to customize any of these values
(such as the maximum number of visits to display) you will need to modify userinfoadmin.php in various
locations of code. If you know how to program, this will be an easy task. If you are a newbie to PHP,
you will want to wait until I roll out the next version of the script.

## 6:APPENDIX ##
This script is very modular. After spending hours customizing a previous script, I decided that I would keep
the code very clean if I ever wrote my own. This section is dedicated to integrating the script into your own
website. For every one of these integrations you will want to include the script with include("userinfo.php");

A. Displaying user hits
This is the most common function. This will spit out the number of hits you've recieved.
stats_get_count();

B. Displaying previous n users
This builds a table with previous user visits. This contains all of their information gathered by the stats
program. Put the number of visitors you want to see in the parenthesis.
stats_get_details(200);

C. Displaying a daily graph of visits
This builds a perdy CSS graph using nucleoGraph. If you want to use this make sure you upload the nucleoGraph
PHP file.
stats_graph_days(5);

D. The following four functions are self explanatory
stats_get_popular(20);
stats_get_domains(20);
stats_get_browsers(20);
stats_get_systems(20);

Login

Username:
Password:

Shoutbox

By !nucleo
Jun 12, 2008 7:56pm
About time you're back... Shoot me an email with your 88x31.
By ?Lee
Jun 12, 2008 3:27pm
vimixx.net has moved to lee-stewart.co.uk!!!
By ?Medvedko
May 4, 2008 7:04am
That's right. Sorry, I am not making much sense, am I? Basically, I created the DB myself instead of using your install script. All necessary tables are there, I added few more based on plugin POST options and added those to the update.php also. At the beginning I added mysql.ssi.php function to both update and winamp_playing scripts as I had some troubles before with include_once.
By !nucleo
May 2, 2008 9:56am
Now I'm really confused, are you modifying my shoutbox script?
By ?Medvedko
Apr 30, 2008 1:08am
another thing is that update script terminates with invalid password (I added the pass in the Additional Options in the plugin and set the pass in the update script.
By ?Medvedko
Apr 30, 2008 1:06am
my fault really. I modded the scripts and added more tables to the DB such as "TIMESTAMP". I think include_once doesn't fetch the mysql function. Or atleast this is what seems to me is the problem.
Name: Shout: This Number: [View All]

Partners

Rand Affiliates

Acecool No Freedom Andreas on the Web Decade Creations