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 UserLevel FROM UserAccounts WHERE FirstName=:first AND LastName=:last");
$query->bindParam(':first', $first);
$query->bindParam(':last', $last);
$query->execute();
$result=$query->fetch(PDO::FETCH_ASSOC);
}
catch(PDOException $e) {
print '
Sorry, a database error occurred.
';
goto last;
}
if($result['UserLevel'] < 100) {
print '
Sorry, the authenticated agent does not have the necessary level to apply OARs.
';
goto last;
}
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 '
OAR uploaded successfully.
';
goto last;
}
goto last;
default:
echo '
Sorry, wrong password.
';
goto last;
}
break;
}
}
default:
echo '
Sorry, incorrect CAPTCHA. Please try again.
';
}
last:
?>