Table of Contents

How to use the "geturl" in good case

See also: ”geturl

Intruduction

The PikkuBot is able to log Avatars, Prims, Sims and Sandboxes. This is possible with the command “getfile” in the file logfile/HUNTER.txt or with the “geturl” command and a Webserver. Of course the last command is much better for the usability, but its another topic. You can use any scripting language you want, in this demo we use PHP and MySQL..

Requirements

Database with MySQL and a Webserver with PHP.

Step by Step

Create a new database

The best program for it is phpMyAdmin. Create a new Database and call it pikkubot.

Creation of a sample table for avatars

This is how the table can looks like:

CREATE TABLE `pikkubot_avs` (
`pikkubot_avs_id` int(11) NOT NULL auto_increment,
`pikkubot_avs_datum` datetime NOT NULL default '0000-00-00 00:00:00',
`pikkubot_avs_lastseen` datetime NOT NULL default '0000-00-00 00:00:00',
`pikkubot_avs_name` text NOT NULL,
`pikkubot_avs_key` text NOT NULL,
`pikkubot_avs_sim` text NOT NULL,
`pikkubot_avs_vector` text NOT NULL,
`pikkubot_avs_hash` varchar(32) NOT NULL default '',
PRIMARY KEY  (`pikkubot_avs_id`),
KEY `pikkubot_avs_hash` (`pikkubot_avs_hash`)
) ENGINE=MyISAM;

A PHP-script for logging in the database

We need a script to log the datas collected from the bot in the database, we call the file log.php:

<?php
// Connect with the Database
//
$link=mysql_connect("localhost","Username","Password");
mysql_select_db("pikkubot");

// The bot send me a avatar name
//
if ($_GET[av_name]!="") {

// Is avatar allready in the database?
//
$select=mysql_query("SELECT count(*) FROM pikkubot_avs WHERE pikkubot_avs_hash='".md5($_GET[av_name])."'");
$row=mysql_fetch_array($select);

// NO
//
if ($row[0]==0) {
$insert=mysql_query("
INSERT INTO pikkubot_avs
(pikkubot_avs_datum, pikkubot_avs_lastseen, pikkubot_avs_key, pikkubot_avs_name, pikkubot_avs_sim, pikkubot_avs_vector, pikkubot_avs_hash)
VALUES
('".date("Y-m-d H:i:s")."', '".date("Y-m-d H:i:s")."', '$_GET[av_key]', '$_GET[av_name]', '$_GET[av_sim]', '$_GET[av_position]', '".md5($_GET[av_name])."')
 ");
}
else
{
$update=mysql_query("
UPDATE pikkubot_avs
SET pikkubot_avs_lastseen='".date("Y-m-d H:i:s")."'
WHERE pikkubot_avs_hash='".md5($_GET[av_name])."'
 ");
}
}
?>

Please replace Username with the MySQL Database User (for example root) and password with the pass of this user.

Insert the URL in the Bot Program

Just insert following command in your Bot window:

geturl http://my_server/log.php

Now the bot should log the found Avatars in the database. Pleace verify this with phpMyAdmin.

PHP-Skript to view the data

Now you need a simple script to show the logged Avatars, we call the file hunted.php:

<?php
// Connection to the Database
//
$link=mysql_connect("localhost","Username","Password");
 mysql_select_db("pikkubot");

$select=mysql_query("select * FROM pikkubot_avs ");
echo "I have found ".mysql_num_rows($select)." Avatars in database.<br><br>";

$select=mysql_query("
select * FROM pikkubot_avs
ORDER BY pikkubot_avs_lastseen DESC
LIMIT 0,50
");

if (mysql_num_rows($select)>0 ) {
echo "<b>Last 50 seen Avatars :</b><br><br>";

echo "<table>";
echo "<tr>";
echo "<td><b>First-Seen</strong></td>";
echo "<td><b>Last-Seen</strong></td>";
echo "<td><b>Avatar-Name</strong></td>";
echo "<td><b>Avatar-Key</strong></td>";
echo "<td><b>Avatar-Sim</strong></td>";
echo "<td><b>Avatar-Vector</strong></td>";
echo "</tr>";

for ($a=0; $a<mysql_num_rows($select); $a++) {
$row=mysql_fetch_array($select);
echo "<tr>";
echo "<td>$row[pikkubot_avs_datum]</strong></td>";
echo "<td>$row[pikkubot_avs_lastseen]</strong></td>";
echo "<td>$row[pikkubot_avs_name]</strong></td>";
echo "<td>$row[pikkubot_avs_key]</strong></td>";
echo "<td>$row[pikkubot_avs_sim]</strong></td>";
echo "<td>$row[pikkubot_avs_vector]</strong></td>";
echo "</tr>";
}
echo "</table>";
}


else
{
echo "... Sorry, no Avatars seen yet ...<br>";
}

?>

Done!

Of course you can edit the scripts for your own use as you like!
See also: Enhance "geturl" for prims