/lib/wasRemoteAdmin.php |
@@ -91,7 +91,6 @@ |
|
function admin_authenticate_user($firstname, $lastname, $password, $tokentime) { |
$request = new HTTP_Request2($this->url, HTTP_Request2::METHOD_POST); |
|
$serializer = new XML_Serializer($this->options); |
$xml = array( |
"methodName" => htmlspecialchars('admin_authenticate_user'), |
@@ -137,7 +136,6 @@ |
|
function admin_create_user($firstname, $lastname, $password, $region_x, $region_y) { |
$request = new HTTP_Request2($this->url, HTTP_Request2::METHOD_POST); |
|
$serializer = new XML_Serializer($this->options); |
$xml = array( |
"methodName" => htmlspecialchars('admin_create_user'), |
@@ -178,6 +176,49 @@ |
), |
), |
); |
|
function admin_update_user($firstname, $lastname, $password, $region_x, $region_y) { |
$request = new HTTP_Request2($this->url, HTTP_Request2::METHOD_POST); |
$serializer = new XML_Serializer($this->options); |
$xml = array( |
"methodName" => htmlspecialchars('admin_update_user'), |
"params" => |
array( "param" => |
array( "value" => |
array("struct" => |
array( |
"member" => |
array( |
"name" => 'password', |
"value" => array( |
"string" => htmlspecialchars($this->raPassword) |
), |
), |
array( |
"name" => 'user_firstname', |
"value" => htmlspecialchars($firstname) |
), |
array( |
"name" => 'user_lastname', |
"value" => htmlspecialchars($lastname) |
), |
array( |
"name" => 'user_password', |
"value" => htmlspecialchars($password) |
), |
array( |
"name" => 'start_region_x', |
"value" => htmlspecialchars($region_x) |
), |
array( |
"name" => 'start_region_y', |
"value" => htmlspecialchars($region_y) |
), |
), |
), |
), |
), |
); |
|
$serializer->serialize($xml); |
$xml_load = $serializer->getSerializedData(); |
@@ -187,7 +228,6 @@ |
|
function admin_get_agents($region_name, $include_children) { |
$request = new HTTP_Request2($this->url, HTTP_Request2::METHOD_POST); |
|
$serializer = new XML_Serializer($this->options); |
$xml = array( |
"methodName" => htmlspecialchars('admin_get_agents'), |
/reset.php |
@@ -0,0 +1,36 @@ |
<!DOCTYPE html> |
<html> |
<head> |
<title>Clockwerk</title> |
<link rel="stylesheet" href="css/gray.css" type="text/css" /> |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
</head> |
<body class="dark-grey"> |
<div> |
<div class="center"> |
<img src="img/clockwerk-logo.png" alt="logo"> |
<h1><?php print gethostname(); ?></h1> |
<hr> |
</div> |
<script type="text/javascript" src="lib/jquery.min.js"></script> |
<form class="dark-grey" style="color:#000;text-shadow:none;text-align:left;max-width:480px;min-width:150px" method="post" action="resetpassword.php"><div class="title"></div> |
<div class="element-input" ><label class="title">Agent First Name<span class="required"></span></label><input class="large" type="text" name="first" required="required"/></div> |
<div class="element-input" ><label class="title">Agent Last Name<span class="required"></span></label><input class="large" type="text" name="last" required="required"/></div> |
<div class="element-password" ><label class="title">Current Password<span class="required"></span></label><input class="large" type="password" name="oldpassword" value="" required="required"/></div> |
<div class="element-password" ><label class="title">New Password<span class="required"></span></label><input class="large" type="password" name="newpassword" value="" required="required"/></div> |
<div class="element-recaptcha" ><label class="title">Captcha</label><script type="text/javascript">var RecaptchaOptions = {theme : "clean"};</script> |
<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=6Lcz9ukSAAAAAPu4CYSJCjPiZeQJgG0ywy4wL_Fj&theme=clean"></script> |
<noscript><iframe src="http://www.google.com/recaptcha/api/noscript?k=6Lcz9ukSAAAAAPu4CYSJCjPiZeQJgG0ywy4wL_Fj&hl=en" height="300" width="500" frameborder="0"></iframe></br> |
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea><input type="hidden" name="recaptcha_response_field" value="manual_challenge"></noscript> |
<script type="text/javascript">if (/#invalidcaptcha$/.test(window.location)) (document.getElementById("recaptcha_widget_div")).className += " error"</script></div> |
|
<div class="submit"> |
<input type="submit" value="Register"> |
<input type="button" onclick="parent.location='welcome.php'" value="Cancel"> |
</div> |
</form> |
<script type="text/javascript" src="lib/gray.js"></script> |
|
</div> |
</body> |
</html> |
/resetpassword.php |
@@ -0,0 +1,84 @@ |
<?php |
|
require_once 'lib/recaptchalib.php'; |
require_once 'lib/wasRemoteAdmin.php'; |
require_once 'lib/uuid.php'; |
|
define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr'); |
|
?> |
<!DOCTYPE html> |
<html> |
<head> |
<title>Clockwerk</title> |
<link rel="stylesheet" href="css/green.css" type="text/css" /> |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
</head> |
<body class="dark-grey"> |
<div> |
<img src="img/clockwerk-logo.png" alt="logo"> |
<h1><?php print gethostname(); ?></h1> |
<hr> |
<p> |
<?php |
|
$first = $_POST["first"]; |
$last = $_POST["last"]; |
$oldpassword = $_POST["oldpassword"]; |
$newpassword = $_POST["newpassword"]; |
|
$resp=recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, |
$_SERVER["REMOTE_ADDR"], |
$_POST["recaptcha_challenge_field"], |
$_POST["recaptcha_response_field"]); |
|
switch((bool)$resp->is_valid) { |
case TRUE: |
$req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
$ret = $req->admin_authenticate_user($first, $last, MD5($oldpassword), '1'); |
$rep = new SimpleXMLElement($ret); |
foreach($rep->params->param->value->struct->member as $member) { |
switch($member->name) { |
case "success": |
switch((bool)$member->value->boolean) { |
case TRUE: |
$ret = $req->admin_update_user($first, $last, $newpassword, '128', '128'); |
$rep = new SimpleXMLElement($ret); |
foreach($rep->params->param->value->struct->member as $member) { |
switch($member->name) { |
case "success": |
switch(boolval($member->value->boolean)) { |
case TRUE: |
echo '<p>Account updated successfully.</p>'; |
goto last; |
default: |
echo '<p>Sorry, the account could not be updated at this time.</p>'; |
goto last; |
} |
break; |
} |
} |
goto last; |
default: |
echo '<p>Sorry, wrong password.</p>'; |
goto last; |
} |
break; |
} |
} |
default: |
echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; |
} |
|
last: |
|
?> |
</p> |
<p> |
<a class="button" href="reset.php">Reset Password</a> |
<a class="button" href="welcome.php">Main Page</a> |
</p> |
</div> |
</div> |
</body> |
</html> |