Home Home Contact Language Videos Photo Gallery Tourdates Wikipedia Software & Education Route planner Articles News service Postcards Shop Heather Nova albums Movies - trailers etc. Creativity Archive Personal Funny Cartoons Downloads Book reviews Mail Site credits HN Mailing list heathernova.de Links Save our world FAQ Let us know what you think Heather Nova tweets Guestbook Heather Nova on Youtube
Basic Chords The E Shape The A Shape The D Shape The C Shape The G Shape Mutlitrack recording on your computer Video editing Webdesign - tips Promote your homepage What is a table? 3D Art Fairy Creating an animation The fairy comes alive Guitar lessons Video lesson : learn to play Walk this world Walk this world, interactive Songwriting Competition ReadSpeaker Like lovers do Like lovers do - medium quality Like lovers do - flash Webserver security LondonRain -chords LondonRain-video How to encourage your own creativity PHP tips and tricks

How to monitor your site performance?

=================== 
Written by Cynthia Fridsma
===================

Google Analytics is a great tool, but Google Analytics doesn't show you all the details you might need to keep your website interesting to your audience, and that's when you can use PHP to measure your site. 

If you really want to know what's happening on your site, then you can use PHP and MySQL to track your site.

First, you need to create a MySQL database to store the referring URLs.

You can create the MySQL table with a tool like "PHPMYADMIN" but what's the fun in that? Instead we're going to create a installation Application that will create the MySQL tabel. 

---// source code of installation.php //----

<?php 
# PHP MySQL installation script 
#
# Programmed by Cynthia Fridsma

# Make a connection with a MySQL database
#
# Make sure that you enter the correct 
# details for your database, username and password
#
# And only use letters and numbers.

error_reporting(E_ALL E_NOTICE);

$user "root";
$password "";
$host "localhost";
$dbname "horizon";
$site_id "_";


$db mysql_connect ($host$user$password) or die ("I can't make a connection with the database");

mysql_select_db ($dbname$db);



$install[] ="CREATE TABLE {$site_id}_search_engine (id INT(10) NOT NULL AUTO_INCREMENT,  
url LONGTEXT, date TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY(id));"

$total=count($install);
echo 
"
$total
"
;
$count=0;
while(
$count <$total){
    if(
mysql_query($install[$count])){
        echo 
"Query. $count is installed
"
;
    } else {
        echo 
"I'm sorry but something went wrong with the query " $count;
    }
    
$count++;
}        


This script, if you use the right username, password and MySQL database, will create a simple table for the referring URLs in the database.

After you've executed the installation application, you will need a few lines of code that will store the referring URLs in the database.

----// source code of : search_engine.php //---

<?php 
# PHP MySQL 
#
# Programmed by Cynthia Fridsma

# Make a connection with a MySQL database
#
# Make sure that you enter the correct 
# details for your database, username and password
#
# And only use letters and numbers.

error_reporting(E_ALL E_NOTICE);

$user "root";
$password "";
$host "localhost";
$dbname "horizon";
$site_id "_";


$db mysql_connect ($host$user$password) or die ("I can't make a connection with the database"); 

mysql_select_db ($dbname$db); 

$search_string strtolower($_SERVER['HTTP_REFERER']);

if(
$search_string !=""){
    
$query=  mysql_query("INSERT INTO {$site_id}_search_engine (url) VALUES 

        ('"
.  
addslashes($search_string)."')");        
}

What happens here? 
This script will store referring URLs in the database. If there's no referring URL then the script won't store the URL.

if($search_string !=""){ 
    
$query=  mysql_query("INSERT INTO {$site_id}_search_engine (url) VALUES  

        ('"
.  
addslashes($search_string)."')");         



With PHPMyAdmin, you can simply see what page is most viewed and how visitors came on your site.
You can throw various queries in PHPMyAdmin.

Tip
It's not so hard to add more information into the database, including the browser (are you using Internet Explorer, Flock, Google Chrome or FireFox?), the operating system (MS-Windows, Linux or that other operating systems that I won't name, it starts with an A and ends with PPLE).

Also, I would like to suggest that you create a separate connection script and use require_once('my_connection.php') to make the MySQL database connection. And you can include the search engine script on the pages that you want to measure.

--// connection script (connection.php) //----

<?php 
# PHP connection  


# Make a connection with a MySQL database 

# Make sure that you enter the correct  
# details for your database, username and password 

# And only use letters and numbers. 

error_reporting(E_ALL E_NOTICE); 

$user "root"
$password ""
$host "localhost"
$dbname "horizon"
$site_id "_"


$db mysql_connect ($host$user$password) or die ("I can't make a connection with the database"); 

mysql_select_db ($dbname$db); 

--// search engine script (search_engine.php) //---

<?php 
# PHP search engine

# Programmed by Cynthia Fridsma 

require_once('connection.php');

// store the referring URL in the database
$search_string strtolower($_SERVER['HTTP_REFERER']); 

if(
$search_string !=""){ 
    
$query=  mysql_query("INSERT INTO {$site_id}_search_engine (url) VALUES  

        ('"
.  addslashes($search_string)."')");         

---// how to use the search engine script into your existing PHP webpage  //----

<?php 
include_once('search_engine.php'); ?>

Use Facebook if you have questions related to this script.

P.S.
If you want to use this script with Horizon QCMS (The Heather Nova Online Magazine is powered by this amazing content management system) then
you won't need the connection script, add this in index.php:

$search_string strtolower($_SERVER['HTTP_REFERER']);

if(
$search_string !=""){
    
// {$site_id}_search_engine
    
$query=  mysql_query("INSERT INTO {$site_id}_search_engine (url) VALUES 

        ('"
.  $qcms->magic_quotes($search_string)."')");        
}