473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

a little help for a little counter

Hello from Italy!

I'm trying to create a little script (php/mysql/javascript) to record
visits of some of my sites. I have sites www.a.com, www.b.com ecc... and
I have my counter script on www.phptrack.net.

I compare the results of my counter with shinystat: visits (I would
better call it "pages viewed") is perfectly ok!! but I have a too big
number of visitors. I think there shoul be a problem with sessions...
could someone help me?

The js file is:

var screen_x=window.screen.width;
var screen_y=window.screen.height;
var cur_location = escape(window.location.toString());
var referer = escape(document.referrer);
document.write('<img
src="http://phptrack.net/phptrack.php?site_id='+phptrack_site_id+'&s_x='+sc reen_x+'&s_y='+screen_y+'&cur_loc='+cur_location+' &referer='+referer+'"
width="0" height="0" border="0"/>');

and the php script is:

<?

session_start();

require('components/phptrack/configure.php');
require('includes/classes/db.php');
$db = new db(DB_HOST,DB_NAME,DB_USER,DB_PASSWORD);
$site_id=(int)$_GET['site_id'];

//$_SESSION[$site_id.'_visitor_id']
//This because a visitor can visit both www.a.com and www.b.com in the
//same session!!
if (!($_SESSION[$site_id.'_visitor_id']>0)) {
$sql_data = new sql_data;
$sql_data->add('previous_visitor_id',0);
$sql_data->add('site_id',$site_id);
$sql_data->add('ip',$_SERVER['REMOTE_ADDR']);
$sql_data->add('language',$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$sql_data->add('browser',$_SERVER['HTTP_USER_AGENT']);
$sql_data->add('screen_x',(int)$_GET['s_x']);
$sql_data->add('screen_y',(int)$_GET['s_y']);
$sql_data->perform('raw_visitors');
$_SESSION[$site_id.'_visitor_id']=$db->insert_id();
}
$sql_data = new sql_data;
$sql_data->add('site_id',$site_id);
$sql_data->add('visitor_id',$_SESSION[$site_id.'_visitor_id']);
$sql_data->add('time','now()');
$sql_data->add('location',$_GET['cur_loc']);
$sql_data->add('referer',$_GET['referer']);
$sql_data->perform('raw_visits');
?>

Thanks...
Jun 2 '08 #1
0 1026

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Shane | last post by:
:) I am following a tutorial for php (hudzilla.org) absolutely loving it however I am having trouble with the counter example <?php // your content here... $filename = 'counter.txt'; // our...
12
by: Andrew Baker | last post by:
What is the best way to lock an individual row in the following scenerio: --TODO - LOCK THIS ROW -- Return the next id SELECT next_id INTO next_id_out FROM owner.my_id_table WHERE app_id =...
7
by: JellyON | last post by:
Hi. Is there a way to delay a call to a page counter (ie. call to a server script from an IMG tag) for the purpose to not lock the page loading awaiting counter be displayed. Maybe a...
0
by: Earl Anderson | last post by:
KB Article Q140908 provided the following function to create an Auto Incrementing Counter: Function Next_Custom_Counter () On Error GoTo Next_Custom_Counter_Err Dim MyDB As Database Dim...
54
by: ash | last post by:
i am writing this program (for exercise1-9 in k&r-2nd edition) which removes extra spaces in string example- "test string" will be "test string" #include<stdio.h> #include<string.h>...
0
by: Trevor L. | last post by:
I decide to put a custom Hit Counter on my page (below). Then I won't be reliant on the standard FrontPage one which uses webbots. It is called by <b>Hit Counter: </b><!--#include...
12
by: devospice | last post by:
Hi, I'm trying to create a download counter for individual files on a web site and I'm not sure how to do this. Right now I'm using Webalizer to just read the log files and see how many times...
5
by: jasonchan | last post by:
How would you set up a counter in javascript that goes from 5 to 0 This is what i have so far and it is not displaying in the div container "counter" for some reason... <!DOCTYPE html PUBLIC...
2
by: gumbercules | last post by:
I am designing a site that is regulary updated with new podcasts. I would like to be able to have a counter next to each podcast showing how many hits/listens/plays/views each particular podcast has...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.