I really wouldn't use XMLRPC for this. llHTTPRequest is really all you need. Use the touch event to capture a student's Sign In/Sign Out, then if you need to actually "watch" them, use llSensorRepeat and sensor to scan the room every once in a while and see if they are still there. Here's how it would work:
key requestid;
key student;
string studentname;
default
{
touch_start(integer number)
{
student = llDetectedKey(0);
studentname = llKey2Name(student);
string time = llGetTimestamp();
string datetime = llGetSubString(time,0,9) + " " + llGetSubString(time,11,18);
// puts the timestamp into the DATETIME format used by MySQL
requestid = llHTTPRequest("http://www.yourdomain.com/yourscript.php",
[HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"],
"parameter1=" + studentname + "¶meter2=" + (string)student + "¶meter3="
+ datetime); //This is the script send to the php script, which will process and connect
with the database
}
http_response(key request_id, integer status, list metadata, string body)
{ //this is where the response from the php script on your server will be processed
if (request_id == requestid)
{
integer intx = llSubStringIndex(body,"<");
string tbody = llGetSubString(body,0,intx);
string error = llGetSubString(body,0,5);
if(llStringTrim(error,STRING_TRIM) != "Error:") //check for error message
{
llInstantMessage(student, tbody);
//llGiveInventory(student, name of item); //uncomment line if you want to
give the students something like a notecard of rules or a pop quiz or whatever.
llInstantMessage(llGetOwner(), studentname + " has joined the class.");
}
else //response if the body is an error message
{
llInstantMessage(llGetOwner(), "There has been an error: " + body);
llInstantMessage(student, "There is an error. The owner has been notified.");
}
}
}
}
okay, I dunno if that compiles or not lol..but it's still not totally complete anyway. A good
start though. You're still going to have to get a web server, and create your database with
fields ID (int, auto_increment, primary), studentName (varchar), studentKey (varchar),
Time_In (datetime), Time_Out (datetime).
Your php script (represented by "yourscript.php" above), will need to gather the parameters sent, use those to populate a new record in the MySQL database, also checking whether the datetime variable goes into the Time_In or the Time_Out fields. Then, it will need to send a response using echo. The way I put it in this example, the error response would need to be something like "Error: " + mysql_error()".
As you can see, I wouldn't go with XMLRPC for this, you need it to be initiated from inworld rather than from the web server. Hope it helps!
/me gets ready for people to tear the code apart lol