jOpenSimWorld

Grid Status: Online
Total Regions: 23
Visitors (30 Days): 7
Total Residents: 490
Online Now: 0
Hypergriders online: 0

Avatar Selection Question

10 years 10 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.

10 years 10 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.

10 years 10 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.066 seconds