/account.php |
@@ -30,26 +30,34 @@ |
$_SERVER["REMOTE_ADDR"], |
$_POST["recaptcha_challenge_field"], |
$_POST["recaptcha_response_field"]); |
|
if(!$resp->is_valid) { |
echo '<p>Sorry, incorrect captcha. Please try again.</p>'; |
} |
else { |
$req = new wasRemoteAdmin('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; |
|
switch((bool)$resp->is_valid) { |
case TRUE: |
$req = new wasRemoteAdmin('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) { |
switch($member->name) { |
case "success": |
switch(boolval($member->value->boolean)) { |
case TRUE: |
echo '<p>Account created successfully.</p>'; |
goto last; |
default: |
echo '<p>Sorry, the account could not be created.</p>'; |
goto last; |
} |
break; |
} |
} |
else { |
echo '<p>Account created successfully.</p>'; |
break; |
} |
} |
break; |
default: |
echo '<p>Sorry, incorrect captcha. Please try again.</p>'; |
} |
|
last: |
|
?> |
</p> |
<p> |
/applyiar.php |
@@ -19,23 +19,57 @@ |
$_POST["recaptcha_challenge_field"], |
$_POST["recaptcha_response_field"]); |
|
if ($resp->is_valid) { |
$req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
$ret = $req->admin_authenticate_user($first, $last, MD5($password), '1'); |
$rep = new SimpleXMLElement($ret); |
foreach($rep->params->param->value->struct->member as $member) { |
if ($member->name == "success" && $member->value->boolean == "0") { |
echo 'Sorry, wrong password.'; |
exit; |
} |
?> |
|
<!DOCTYPE html> |
<html> |
<head> |
<title>Clockwerk</title> |
<link rel="stylesheet" href="css/gray.css" type="text/css" /> |
</head> |
<body class=dark-grey> |
<div class="center"> |
<img src="img/clockwerk-logo.png"> |
<h1><?php print gethostname(); ?></h1> |
<hr> |
|
<?php |
|
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($password), '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: |
if (file_exists($file)) { |
chmod($file, 0644); |
$req->admin_console_command('load iar -m '.$first. ' '.$last.' / '.$file); |
chmod($file, 0600); |
echo '<p>IAR uploaded successfully.</p>'; |
} |
goto last; |
default: |
echo '<p>Sorry, wrong password.</p>'; |
goto last; |
} |
break; |
} |
} |
default: |
echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; |
} |
if (file_exists($file)) { |
chmod($file, 0644); |
$req->admin_console_command('load iar '.$file. ' '.$last.' / '.$file); |
chmod($file, 0600); |
header('Location: welcome.php'); |
exit; |
} |
} |
|
echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; |
last: |
|
?> |
<p> |
<a class="button" href="welcome.php">Main Page</a> |
</p> |
</div> |
</body> |
</html> |
|
/applyoar.php |
@@ -29,40 +29,75 @@ |
$_POST["recaptcha_challenge_field"], |
$_POST["recaptcha_response_field"]); |
|
if ($resp->is_valid) { |
$req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
$ret = $req->admin_authenticate_user($first, $last, MD5($password), '1'); |
$rep = new SimpleXMLElement($ret); |
foreach($rep->params->param->value->struct->member as $member) { |
if ($member->name == "success" && $member->value->boolean == "0") { |
echo 'Sorry, wrong password.'; |
exit; |
} |
?> |
|
<!DOCTYPE html> |
<html> |
<head> |
<title>Clockwerk</title> |
<link rel="stylesheet" href="css/gray.css" type="text/css" /> |
</head> |
<body class=dark-grey> |
<div class="center"> |
<img src="img/clockwerk-logo.png"> |
<h1><?php print gethostname(); ?></h1> |
<hr> |
|
<?php |
|
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($password), '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: |
try { |
$mysql = new PDO('mysql:host='.$MYSQL_HOSTNAME.';dbname='.$MYSQL_DATABASE.';', $MYSQL_USERNAME, $MYSQL_PASSWORD); |
$mysql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
$query = $mysql->prepare("SELECT RegionName FROM regions WHERE owner_uuid=(SELECT PrincipalID FROM UserAccounts WHERE FirstName=:first AND LastName=:last)"); |
$query->bindParam(':first', $first); |
$query->bindParam(':last', $last); |
$query->execute(); |
} |
catch(PDOException $e) { |
print '<p>Sorry, the authenticated agent is not the owner of the region to download.</p>'; |
goto last; |
} |
while ($result = $query->fetchObject()) { |
if ($result->RegionName == $region) { |
if (file_exists($file)) { |
$req->admin_console_command('change region '.$region); |
chmod($file, 0644); |
$req->admin_console_command('load oar '.$file); |
chmod($file, 0600); |
echo '<p>OAR uploaded successfully.</p>'; |
goto last; |
} |
} |
} |
goto last; |
default: |
echo '<p>Sorry, wrong password.</p>'; |
goto last; |
} |
break; |
} |
} |
default: |
echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; |
} |
try { |
$mysql = new PDO('mysql:host='.$MYSQL_HOSTNAME.';dbname='.$MYSQL_DATABASE.';', $MYSQL_USERNAME, $MYSQL_PASSWORD); |
$mysql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
$query = $mysql->prepare("SELECT RegionName FROM regions WHERE owner_uuid=(SELECT PrincipalID FROM UserAccounts WHERE FirstName=:first AND LastName=:last)"); |
$query->bindParam(':first', $first); |
$query->bindParam(':last', $last); |
$query->execute(); |
} |
catch(PDOException $e) { |
print 'The given agent is not the owner of the region to download.'; |
return 1; |
} |
while ($result = $query->fetchObject()) { |
if ($result->RegionName == $region) { |
if (file_exists($file)) { |
$req->admin_console_command('change region '.$region); |
chmod($file, 0644); |
$req->admin_console_command('load oar '.$file); |
chmod($file, 0600); |
header('Location: welcome.php'); |
exit; |
} |
} |
} |
} |
|
echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; |
last: |
|
?> |
|
<p> |
<a class="button" href="welcome.php">Main Page</a> |
</p> |
</div> |
</body> |
</html> |