Shortnote

For a more serious solution, we can log visitors to a database and then display the data using gnuplot. In order to do this, we add the LSL script in the Code section to the visitors primitive and then modify the visitors script to pass data to that web tracking PHP script script.

Then using gnuplot we can display that data, for example on this wiki.

Creating the SQLite Database

A database is needed to store the visitors, this will be a database called visitors.sqlite with the following structure:

CREATE TABLE "visitors" (
	 "time" text NOT NULL,
	 "name" text NOT NULL
);

and will be place in the same directory as the PHP script.

Modifying the Visitors Scripts

The following line:

llMessageLinked(LINK_THIS, 0, llList2String(llParseString2List(llGetTimestamp(), ["."], []), 0) + "," + llDetectedName(num), "");

must be added to the visitors scripts, under the line where visitors get added to vList:

vList += [ llGetTimestamp() ] + [ llDetectedName(num) ];

Example Plot

Code: LSL Web Tracker

///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
key pReq = NULL_KEY;
 
default
{
    link_message(integer sender_num, integer num, string str, key id) {
        pReq = llHTTPRequest("http://grimore.org/db/visitors/visitors.php?apiKey=63ddfca327&data=" + llStringToBase64(str), [], ""); 
    }
    http_response(key request_id, integer status, list metadata, string body) {
        if(request_id != pReq) return;
        if(body != "VACK") llSay(DEBUG_CHANNEL, "Failed to insert visitor into database.");
    }
}

Code: PHP Visitors Receiver

visitors.php
<?php
 
 //////////////////////////////////////////////////////////
 //   (C) Wizardry and Steamworks 2013, license: GPLv3   //
 // Please see: http://www.gnu.org/licenses/gpl.html     //
 // for legal details, rights of fair usage and          //
 // the disclaimer and warranty conditions.              //
 //////////////////////////////////////////////////////////
 
 // Test whether the API key is set.
 if(!isset($_GET['apiKey'])) return;
 // Authentication.
 if($_GET['apiKey'] != '63ddfca327') return;
 // Do we have a visitor?
 if(!isset($_GET['data'])) return;
 $visitor = str_getcsv(base64_decode($_GET['data']));
 // Bail out if the visitor data line is improperly formatted.
 if(count($visitor) != 2) return;
 
 $db = new PDO('sqlite:visitors.sqlite');
 $q = $db->prepare("INSERT INTO visitors(time,name) VALUES(:visitor_time, :visitor_name)");
 try {
  $q->execute(array(':visitor_time' => $visitor[0], ':visitor_name' => $visitor[1]));
 }
 catch(PDOException $e) {
  die($e->getMessage());
 }
 print "VACK";
 return;
 
?>

secondlife/visitors/external_database.txt ยท Last modified: 2022/11/24 07:46 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.