LSL PHP Chatlogger
This script will record local chat and save it to an SQL database using PHP. The chatlog can then be viewed in HTML format.
The host I was using for the PHP appears to be down, I'm looking for a backed up copy
LSL
string url;
string location;
list params;
integer startup;
key requestid;
string table;
default
{
on_rez(integer s)
{
llResetScript();
}
state_entry()
{
table=llGetKey();
table=llDeleteSubString(table,8,8);
table=llDeleteSubString(table,12,12);
table=llDeleteSubString(table,16,16);
table=llDeleteSubString(table,20,20);
url="http://yoursite.com/create_table.php?table="+table;
requestid=llHTTPRequest(url,params,"");
}
listen(integer chan, string name, key id, string mess)
{
vector pos=llGetPos();
location=llGetRegionName()+","+(string)pos.x+","+(string)pos.y+","+(string)pos.z;
url="http://yoursite.com/chatlogger.php?name="+llEscapeURL(name)+"&uuid="+(string)id+"&sim="+llEscapeURL(llGetRegionName())+"&x="+(string)pos.x+"&y="+(string)pos.y+"&z="+(string)pos.z+"&message="+llEscapeURL(mess)+"&table="+table;
llHTTPRequest(url,params,"");
}
http_response(key request_id, integer status, list metadata, string body)
{
if (request_id == requestid)
{
llOwnerSay("Communications Established!\nYou may find the chat log at this URL:");
llOwnerSay("http://yoursite.com/chatlogger_view.php?table="+table);
llLoadURL(llGetOwner(),"Visit the chatlog page now?","http://yoursite.com/chatlogger_view.php?table="+table);
llListen(0,"",NULL_KEY,"");
}
}
}
page revision: 4, last edited: 04 Mar 2010 00:18