Translations of this page:
  • English (USA)
  • Deutsch (German)

"geturl" for Prims

Please begin this tutorialand create the scripts:
How do you use the command "geturl"

Create a table for the prims

This is a example how the table can looks like:


CREATE TABLE `pikkubot_prims` (
`pikkubot_prims_id` int(11) NOT NULL auto_increment,
`pikkubot_prims_datum` datetime NOT NULL default '0000-00-00 00:00:00',
`pikkubot_prims_name` text NOT NULL,
`pikkubot_prims_sim` text NOT NULL,
`pikkubot_prims_position` text NOT NULL,
PRIMARY KEY  (`pikkubot_prims_id`),
KEY `pikkubot_prims_datum` (`pikkubot_prims_datum`)
) ENGINE=MyISAM;

Enhance the log.php for prims

Now we enlarge the log.php with some lines:

if ($_GET[prim_name]!="") {
$insert=mysql_query("
INSERT INTO pikkubot_prims
(pikkubot_prims_datum, pikkubot_prims_name, pikkubot_prims_sim, pikkubot_prims_position)
VALUES
('".date("Y-m-d H:i:s")."', '$_GET[prim_name]', '$_GET[prim_sim]', '$_GET[prim_position]')
");
}

A PHP-script for logging in the database

A simple script to show the logged Prims, we call the file prims.php:

<?php
// Connect with Database
//
$link=mysql_connect("localhost","USERNAME","PASSWORD");
mysql_select_db("pikkubot");

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

$select=mysql_query("
select * FROM pikkubot_prims
ORDER BY pikkubot_prims_datum DESC
LIMIT 0,500
");

if (mysql_num_rows($select)>0 ) {

echo "<b>Last 500 Prims with text regarding the topic \"camping\" :</b><br><br>";

echo "<table>";
echo "<tr>";
echo "<td><b>LastSeen</strong></td>";
echo "<td><b>Prim-Text</strong></td>";
echo "<td><b>Prim-Sim</strong></td>";
echo "<td><b>Prim-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_prims_datum]</td>";
echo "<td>$row[pikkubot_prims_name]";
echo "<br><a href='secondlife://".toSLURL($row[pikkubot_prims_sim], $row[pikkubot_prims_position])."'>secondlife://".toSLURL($row[pikkubot_prims_sim], $row[pikkubot_prims_position])."</a></td>";
echo "<td>$row[pikkubot_prims_sim]</strong></td>";
echo "<td>$row[pikkubot_prims_position]</strong></td>";
echo "</tr>";
}
echo "</table>";
}
else
{
echo "... Sorry, no Prims seen yet ...<br>";
}

function toSLURL($sim, $loc) {
        // <0.112076, 1.827652, -1.322716>
        $loc=str_replace(">","",$loc);
        $loc=str_replace("<","",$loc);
        $loc_exp=explode(",", $loc);
        $sim_exp=explode(" (", $sim);

        return $sim_exp[0]."/".round(trim($loc_exp[0]))."/".round(trim($loc_exp[1]))."/".round(trim($loc_exp[2]));
}

?>

Configuration in Pikku

For the end just, use the command “huntwords” to say, witch words should be logged when they are foundl:
huntwords camp,pay,earn”

Finished!


howtos/geturl_for_prims.txt · Last modified: 2008/11/22 17:49 by rebekka
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0