Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Storing information remotely

Ginge Reymont
Registered User
Join date: 10 Oct 2005
Posts: 190
08-05-2006 08:27
I am trying to build a questionnaire that reports the data back to a remote website which then stores it in something, I planned on making it so people could change their mind and change their answers, does anyone know how this could possibly be done, I have no experience in PHP Mysql or anything, i have the LsL script basicly done.

Thanks in advance
Ginge Reymont

(IM me)
Siobhan Taylor
Nemesis
Join date: 13 Aug 2003
Posts: 5,476
08-05-2006 08:30
From: Ginge Reymont
I am trying to build a questionnaire that reports the data back to a remote website which then stores it in something, I planned on making it so people could change their mind and change their answers, does anyone know how this could possibly be done, I have no experience in PHP Mysql or anything, i have the LsL script basicly done.

Thanks in advance
Ginge Reymont

(IM me)
Easiest way is to collect the data as normal, then email it to yourself. Not as fast as using XML, but in this case, speed doesn't seem that important. Of course... changing their answers might be an issue, bt if you identify an answer set with a name (even if the name isn't ever displayed anywhere) then it's not impossible.
_____________________
http://siobhantaylor.wordpress.com/
Xavior Nicholas
Registered User
Join date: 24 May 2006
Posts: 25
08-05-2006 08:39
I have this kind of set up exactly already with one of my projects. It uses php to save data from SL to mysql. IM me in game and I can show you how it all works. It's not all that difficult.
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
08-05-2006 11:57
This would actually be the PERFECT place for an 'llHTTPRequest()'. You could even make a web page with a form, and have the LSL send POST data in exactly the same format as the web page. That way you can have the same survey in-game and on the web somewhere. Of course, the in-game one would be more open to changing the anwers since you can more readily verify the identity of the questionee.
Navillus Batra
Registered User
Join date: 4 Jul 2006
Posts: 22
HttpRequest, PHP, mySQL
08-19-2006 19:00
So I setup an mySQL database to log information from Second Life.

This is the LL Script Code

llHTTPRequest("http://www.website.com/info.php?Com=" + (string)uniqueID + "&akey=" + myaKey + "&aid=" + aid + "&location=" + (string)llGetPos() + "&name=" + botName + "&talkerid=" + llKey2Name(id),[HTTP_METHOD,"GET"],"";);

This is the PHP code

<?php

//echo $_GET['Com'];
$akey = $_GET['akey'];
$aid = $_GET['aid'];
$location = $_GET['location'];
$name = $_GET['name'];
$talkerid = $_GET['talkerid'];


$con = mysql_connect("secureserver.net","databasename","databasepassword";);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("databasename";);

$insert = mysql_query("INSERT INTO tablename (akey, aid, location, name, talkerid) VALUES ('$akey', '$aid', '$location', '$name', '$talkerid')",$con);

echo "Data Info Recieved";
?>

Of course the mySQL database has to have these columns already setup.
I hope this is helpful.
Xavior Nicholas
Registered User
Join date: 24 May 2006
Posts: 25
08-19-2006 22:29
From: Navillus Batra
So I setup an mySQL database to log information from Second Life.

This is the LL Script Code

llHTTPRequest("http://www.website.com/info.php?Com=" + (string)uniqueID + "&akey=" + myaKey + "&aid=" + aid + "&location=" + (string)llGetPos() + "&name=" + botName + "&talkerid=" + llKey2Name(id),[HTTP_METHOD,"GET"],"";);

This is the PHP code

<?php

//echo $_GET['Com'];
$akey = $_GET['akey'];
$aid = $_GET['aid'];
$location = $_GET['location'];
$name = $_GET['name'];
$talkerid = $_GET['talkerid'];


$con = mysql_connect("secureserver.net","databasename","databasepassword";);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("databasename";);

$insert = mysql_query("INSERT INTO tablename (akey, aid, location, name, talkerid) VALUES ('$akey', '$aid', '$location', '$name', '$talkerid')",$con);

echo "Data Info Recieved";
?>

Of course the mySQL database has to have these columns already setup.
I hope this is helpful.


this would work, but I would suggest using llEscapeURL() on the variables that are going to be put in the HTTP request, in case there's any spaces or anything. Also, you might want to use POST instead of GET.