/account.php |
@@ -1,7 +1,7 @@ |
<?php |
|
require_once 'lib/recaptchalib.php'; |
require_once 'lib/wasRemoteAdmin.php'; |
require_once 'lib/kos.php'; |
require_once 'lib/uuid.php'; |
|
define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr'); |
@@ -30,20 +30,10 @@ |
echo '<p>Sorry, incorrect captcha. Please try again.</p>'; |
} |
else { |
$req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
$req = new KOS('http://127.0.0.1:10000', 'opensim'); |
$uuid = UUID::v4(); |
$ret = $req->admin_create_user($first, $last, $password, '128', '128'); |
$rep = new SimpleXMLElement($ret); |
foreach($rep->params->param->value->struct->member as $member) { |
if($member->name == "success" && $member->value->boolean == "0") { |
echo '<p>Sorry, the account could not be created.</p>'; |
break; |
} |
else { |
echo '<p>Account created successfully.</p>'; |
break; |
} |
} |
$req->send('create user '.$first.' '.$last.' '.$password.' '.$email.' '.$uuid); |
echo '<p>Account created successfully.</p>'; |
} |
?> |
</p> |
/lib/kos.php |
@@ -0,0 +1,93 @@ |
<?php |
|
///////////////////////////////////////////////////////////// |
// Wizardry and Steamworks (c) was.fm - 2013, License: MIT // |
// // |
// Permission is hereby granted, free of charge, to any // |
// person obtaining a copy of this software and associated // |
// documentation files (the "Software"), to deal in the // |
// Software without restriction, //including without // |
// limitation the rights to use, copy, modify, merge, // |
// publish, distribute, sublicense, and/or sell copies of // |
// the Software, and to permit persons to whom the // |
// Software is furnished to do so, subject to the // |
// following conditions: // |
// // |
// The above copyright notice and this permission notice // |
// shall be included in all copies or substantial portions // |
// of the Software. // |
// // |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF // |
// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT // |
// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS // |
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO // |
// EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE // |
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER // |
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // |
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR // |
// THE USE OR OTHER DEALINGS IN THE SOFTWARE. // |
///////////////////////////////////////////////////////////// |
|
/* Requires pear module HTTP Request2 and XML Serializer. */ |
require_once 'HTTP/Request2.php'; |
require_once 'XML/Serializer.php'; |
|
class KOS { |
|
var $url; |
var $pwd; |
|
function KOS($url,$pwd) { |
$this->url = $url; |
$this->pwd = $pwd; |
} |
|
function send($cmd) { |
$request = new HTTP_Request2($this->url, HTTP_Request2::METHOD_POST); |
$options = |
array ( |
"indent" => " ", |
"linebreak" => "\n", |
"typeHints" => false, |
"addDecl" => true, |
"encoding" => "UTF-8", |
"rootName" => "methodCall", |
"defaultTagName" => "member", |
"mode" => "simplexml" |
); |
|
$serializer = new XML_Serializer($options); |
$xml = array( |
"methodName" => htmlspecialchars('admin_console_command'), |
"params" => |
array( "param" => |
array( "value" => |
array("struct" => |
array( |
"member" => |
array( |
"name" => 'password', |
"value" => array( |
"string" => htmlspecialchars($this->pwd) |
), |
), |
array( |
"name" => 'command', |
"value" => array( |
"string" => htmlspecialchars($cmd) |
) |
) |
), |
), |
), |
), |
); |
|
$serializer->serialize($xml); |
$xml_load = $serializer->getSerializedData(); |
$request->setBody($xml_load); |
return $request->send()->getBody(); |
} |
} |
|
?> |
/register.php |
@@ -6,8 +6,8 @@ |
<img src="img/spectacledowl-logo.png"> |
<script type="text/javascript" src="lib/jquery.min.js"></script> |
<form class="formoid-default-green" style="color:#000;text-shadow:none;text-align:left;max-width:480px;min-width:150px" method="post" action="account.php"><div class="title"></div> |
<div class="element-input" ><label class="title">Avatar First Name<span class="required"></span></label><input class="large" type="text" name="first" required="required"/></div> |
<div class="element-input" ><label class="title">Avatar Last Name<span class="required"></span></label><input class="large" type="text" name="last" required="required"/></div> |
<div class="element-input" ><label class="title">First Name<span class="required"></span></label><input class="large" type="text" name="first" required="required"/></div> |
<div class="element-input" ><label class="title">Last Name<span class="required"></span></label><input class="large" type="text" name="last" required="required"/></div> |
<div class="element-password" ><label class="title">Password<span class="required"></span></label><input class="large" type="password" name="password" value="" required="required"/></div> |
<div class="element-email" ><label class="title">E-Mail<span class="required"></span></label><input class="large" type="email" name="email" value="" required="required"/></div> |
<div class="element-recaptcha" ><label class="title">Captcha</label><script type="text/javascript">var RecaptchaOptions = {theme : "clean"};</script> |