Avatar Selection Question

5 years 6 months ago #2078 by rico87
Hello

Ive been using this component for quite a while now, i have a maybe stupid question about it,

I started developing a webinterface using jOpenSim which is not bound to joomla, however i wonder which mysql tables need to be copied for the default appereance, and if i could Maybe get a sample code?

Regards and have a nice day

Rico

Please Log in or Create an account to join the conversation.

5 years 6 months ago #2079 by foto50
Hi rico

At jOpenSim, I basically create a special account as default account and then during registration copy all inventory folders/items from the robust database tables "inventoryfolders" and "inventoryitems" with new UUID's for the new user. My code still needs some optimization, but since all the component is open source, you can easy investigate ... specially the plugin jOpenSimRegister as well as the main class of the component (opensim.class.php).

I currently am very curious about the opensim tools published by JustinCC ( github.com/justincc/opensimulator-tools/...ster/integration/php ) but not got the time to investigate those closer yet ;) Maybe there is also something u can go on with.

Greetz
FoTo50

Please Log in or Create an account to join the conversation.

5 years 6 months ago #2081 by rico87
Hello Foto50

i figured it out now by studying plg_jopensim_register, but because i am using the createuser account on robust i had to do a additional step.

i post my testing code here which i copied from the plugin and adjusted to work without joomla for anyone who is interested :-)
<?php
include "open_config/config.php";
function GUID()
{
    if (function_exists('com_create_guid') === true)
    {
        return trim(com_create_guid(), '{}');
    }

    return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}

function CreateUser($ip,$port,$firstname,$lastname,$password,$email,$avatar)

{
$uuid = GUID();
$url = "http://$ip:$port/accounts";
$myvars = "METHOD=createuser&FirstName=$firstname&LastName=$lastname&Password=$password&Email=$email&PrincipalID=$uuid";
$user = $uuid;
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_POST, 1);
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars);
curl_setopt( $ch, CURLOPT_HEADER, 0);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec( $ch );
if (strpos($response,'Failure') !== false) {
    echo 'Failed to Create Account';
}
else
{
$new = sprintf("DELETE FROM Avatars WHERE PrincipalID='%s'",
"$user");
$tt = mysql_query($new);

	$query2 = sprintf("INSERT INTO Avatars SELECT '%s' AS PrincipalID, Avatars.`Name`, Avatars.`Value` FROM Avatars WHERE Avatars.PrincipalID = '%s'",
								"$user",
								"$avatar");
                $test2 = mysql_query($query2);
		$query = sprintf("UPDATE Avatars SET Avatars.`Value` = '%1\$s' WHERE Avatars.PrincipalID = '%1\$s' AND Avatars.`Name` = 'UserID'",
								"$user");
                $test = mysql_query($query);
echo "User Account $user Resident Created<br>You can now Login";
}
}
?>
The following user(s) said Thank You: Dayna Bedrosian

Please Log in or Create an account to join the conversation.

Time to create page: 0.126 seconds

Search

Our Regions

Region: Loc X: Loc Y:
Agora 1000 998
Basilic… 1007 1000
Bay Sho… 997 1003
Boardwa… 1003 1004
BoraBor… 1002 999
Canary … 997 999
Creator… 990 990
Crystal… 1001 1000
DeepTho… 1005 998
Fantasy 1009 1004
FoToSan… 996 995
Hiatus 1007 1004
jAdult 1003 1003
jCity 1009 1003
jOpenWe… 1000 999
JuniorT… 1002 1001
Kanadah… 1002 1000
Kansas 1007 1003
Kodu 980 983
LindaKe… 1000 997
MA2 1008 1003
MA5 1008 1004
MonteSc… 1001 1001
Mountai… 1009 1000
Naos 999 999
Pangaea 1005 1003
RiverSi… 999 1000
Sakani 999 998
Snambin 1001 998
Tropica… 1004 1003
ViewerH… 1002 998
WaterWo… 1001 999
WilderK… 1000 1000

Donate jOpenSim

Please consider supporting our efforts.

Amount