Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

WEBSITE for user key lookup.

Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
11-01-2006 09:07
This www site is ment to be used IN game to get a key.
This is Not a DB its is a real lookup.

syntax..
Say your looking up Dimentox Travanti
http://lsl.dimentox.com/name2key.php?fname=dimentox&lname=travanti


Hope you enjoy it
Dim.
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
11-01-2006 09:19
Was trying to paste the code for this and err it wont reply sigh.


And in the intrest of oper source heres the backend stuff
You will need lsllib installed and mon for a unix server.
//the php script
CODE

<?
ob_start();
//use $fname
//$lname
if (!$fname || !$lname) {
die("ERROR: Blank name given");
}
$fname = escapeshellcmd($fname);
$lname = escapeshellcmd($lname);
$test = exec("/path/to/name2keyscript/name2key.sh \"$fname\" \"$lname\"");
$data = $test;
//echo $data[2];
//ctart parsing the string
if ($data == "00000000000000000000000000000000" || !$data) {
die("ERROR: User Does not Exist");
}
for ($i = 0; $i < 32; $i++) {
if ($i == 8 || $i == 12 || $i == 16 || $i == 20)
{
$test2 = $test2 . "-";
} else { }
$test2 = $test2 . $data[$i];
}


echo $test2;

?>
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
11-01-2006 09:24
heres the code for the shell script
youll need a valid acount name and password
CODE

#!/path/to/bash
/path/to/mono /path/to/name2key.exe firstname lastname password $1 $2 | grep UUID |awk '{print $2}'
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
11-01-2006 11:25
A quick little script to allow you to do name->key lookups in LSL asynchronously.

CODE

integer channel = 50;
integer return_channel = 51;

//simple control script
default
{
state_entry()
{//oh noo we sent them all at once (almost) how will we ever know which resonce is which? no fear our script keeps track.
llMessageLinked(LINK_THIS, channel, "Philip Linden", "");
llSleep(0.5);
llMessageLinked(LINK_THIS, channel, "Peter Linden", "");
llSleep(0.5);
llMessageLinked(LINK_THIS, channel, "Zaphod Linden", "");
llSleep(0.5);
llMessageLinked(LINK_THIS, channel, "Zork Linden", "");
llSleep(0.5);
llMessageLinked(LINK_THIS, channel, "Dan Linden", "");
}
link_message(integer link, integer chan, string msg, key id)
{
if(chan == return_channel)
{
if(id)
{//woot valid key ^_^
llOwnerSay("User: \"" + msg + "\" Key: " + (string)id);
}
else
{//booo user not found or something
llOwnerSay("User: \"" + msg + "\" : " + (string)id);
}
}
}
}


CODE

//Be sure in your script to do "if(id)" this will test to make sure it's a valid key, if it's an invalid key then you know the lookup failed at the server side.

integer channel = 50;
integer return_channel = 51;

list handles;
list names;

default
{
link_message(integer link, integer chan, string msg, key id)
{
if(chan == channel)
{
list t = llParseString2List(msg, [" "], []);
if(llGetListLength(t) == 2)
{
names += msg;
handles += llHTTPRequest("http://lsl.dimentox.com/name2key.php?fname="+ llDumpList2String(t, "&lname="), [] ,"");
}
else
llMessageLinked(LINK_THIS, return_channel, msg, "");
}
}
http_response(key id, integer status, list meta, string body)
{
integer t = llListFindList(handles, [id]);
if(~t)//same as (t != -1) except alot faster
{
llMessageLinked(LINK_THIS, return_channel, llList2String(names, t), body);
names = llDeleteSubList(names, t);
handles = llDeleteSubList(handles, t);
}
}
}
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
11-01-2006 11:35
Awesome,

I love open source =)
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
11-01-2006 11:55
This makes it a ton easier than having to use a sensor to get a key id to store for what ever use.
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
11-01-2006 12:34
For those of us who aren't up to date on the lsllib project... how does name2key.exe work? Is it accessing an off-world database, or is it sending a query into SL using the SL protocol(s)?
Dimentox Travanti
DCS Coder
Join date: 10 Sep 2006
Posts: 228
11-01-2006 13:16
From: Ziggy Puff
For those of us who aren't up to date on the lsllib project... how does name2key.exe work? Is it accessing an off-world database, or is it sending a query into SL using the SL protocol(s)?



It sends a query into SL, with the char it logs in.
this is a real time query, most other key2name sites give you a cached db one.
_____________________
LSL Scripting Database - http://lsl.dimentox.com
Ziggy Puff
Registered User
Join date: 15 Jul 2005
Posts: 1,143
11-01-2006 13:24
Thanks.