RemoteAdmin:admin exists user

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Returned Parameters)
(PHP)
Line 70: Line 70:
 
<?php
 
<?php
  
// Including the RemoteAdmin PHP class.
+
$request = xmlrpc_encode_request("admin_exists_user", array("password" => "plop", "user_firstname" => "Test", "user_lastname" => "User"));
include('RemoteAdmin.php');
+
  
// Instantiate the class with parameters identical to the Python example above
+
$context = stream_context_create(array('http' => array(
$myRemoteAdmin = new RemoteAdmin('127.0.0.1', 9000, 'secret');
+
    'method' => "POST",
 +
    'header' => "Content-Type: text/xml\r\nconnection: close\r\n",
 +
    'content' => $request
 +
)));
 +
 
 +
$file = file_get_contents("http://localhost:5000", false, $context);
 +
 
 +
$response = xmlrpc_decode($file);
 +
if ($response && xmlrpc_is_fault($response)) {
 +
    trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
 +
} else {
 +
    print_r($response);
 +
}
  
// Invoke admin_exists_user (multiple parameters)
 
$parameters = array('user_firstname' => 'John', 'user_lastname' => 'Doe');
 
$myRemoteAdmin->SendCommand('admin_exists_user', $parameters);
 
 
?>
 
?>
 
</source>
 
</source>

Revision as of 18:07, 3 April 2013

admin_exists_user remotely allows to check if a certain user account exists


Contents

Enabling admin_exists_user

If not all functions are enabled, use admin_exists_user to enable the function in the [RemoteAdmin] section

enabled_methods = admin_exists_user,...


Parameters

Required Parameters

These parameters are required

parameter Description Values
user_firstname first name of user
user_lastname last name of user


Optional Parameters

No optional parameters.


Returned Parameters

Returned Parameters

These parameters are returned by Remote Admin

parameter Description Values
success true when successfull true, false
user_firstname first name of user
user_lastname last name of user
lastlogin timestamp of last user login This is a Unix timestamp. This was buggy before OpenSimulator git master f064075 (post 0.7.5) where the timestamp was returned in a timestamp field in lastlogin instead. If the user did not exist, this value is 0.

Error messages

No error messages.

Notes

Example

PHP

<?php
 
$request = xmlrpc_encode_request("admin_exists_user", array("password" => "plop", "user_firstname" => "Test", "user_lastname" => "User"));
 
$context = stream_context_create(array('http' => array(
    'method' => "POST",
    'header' => "Content-Type: text/xml\r\nconnection: close\r\n",
    'content' => $request
)));
 
$file = file_get_contents("http://localhost:5000", false, $context);
 
$response = xmlrpc_decode($file);
if ($response && xmlrpc_is_fault($response)) {
    trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
    print_r($response);
}
 
?>

RemoteAdmin RemoteAdmin:Commands

Personal tools
General
About This Wiki