clockwerk-www

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 43  →  ?path2? @ 44
/sendiar.php
@@ -1,48 +1,47 @@
<?php
 
require_once 'lib/recaptchalib.php';
require_once 'lib/wasRemoteAdmin.php';
///////////////////////////////////////////////////////////////////////////
// Copyright (C) Wizardry and Steamworks 2014 - License: MIT //
///////////////////////////////////////////////////////////////////////////
 
define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr');
require_once 'lib/recaptchalib.php';
require_once 'lib/wasRemoteAdmin.php';
 
define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr');
$first = $_POST["first"];
$last = $_POST["last"];
$password = $_POST["password"];
$first = $_POST["first"];
$last = $_POST["last"];
$password = $_POST["password"];
 
$resp=recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
$resp=recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY,
$_SERVER["REMOTE_ADDR"],
$_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;
}
}
$iar_path = '/var/lib/iar/'.$first.'_'.$last.'/'.$first.'_'.$last.'.iar';
if(file_exists($iar_path)) {
if(false !== ($handler = fopen($iar_path, 'r'))) {
header('Content-Description: File Transfer');
header('Content-Type: application/x-gzip-compressed');
header('Content-Disposition: attachment; filename='.basename($iar_path));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: '.filesize($iar_path));
while(false !== ($chunk = fread($handler, 4096))) {
echo $chunk;
}
}
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;
}
}
$iar_path = '/var/lib/iar/'.$first.'_'.$last.'/'.$first.'_'.$last.'.iar';
if (file_exists($iar_path)) {
header('Content-Description: File Transfer');
header('Content-Type: application/x-gzip-compressed');
header('Content-Disposition: attachment; filename='.basename($iar_path));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: '.filesize($iar_path));
readfile($iar_path);
exit;
}
}
echo '<p>Sorry, incorrect captcha. Please try again.</p>';
echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>';
 
/sendoar.php
@@ -1,43 +1,17 @@
<?php
 
/////////////////////////////////////////////////////////////
// Wizardry and Steamworks (c) was.fm - 2014, 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. //
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
// CONFIGURATION //
/////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
// Copyright (C) Wizardry and Steamworks 2014 - License: MIT //
///////////////////////////////////////////////////////////////////////////
 
// Hostname or IP of your OpenSim MySQL server.
define("MYSQL_HOSTNAME", "localhost");
$MYSQL_HOSTNAME='localhost';
// Username of the OpenSim MySQL user.
define("MYSQL_USERNAME", "opensim");
$MYSQL_USERNAME='opensim';
// Password of the OpenSim MySQL user.
define("MYSQL_PASSWORD", "***");
$MYSQL_PASSWORD='***';
// Name of the OpenSim database on the MySQL server.
define("MYSQL_DATABASE", "opensim");
$MYSQL_DATABASE='opensim';
 
require_once 'lib/recaptchalib.php';
require_once 'lib/wasRemoteAdmin.php';
@@ -44,10 +18,10 @@
 
define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr');
 
$first = $_POST["first"];
$last = $_POST["last"];
$region = $_POST["region"];
$password = $_POST["password"];
$first = $_GET["first"];
$last = $_GET["last"];
$region = $_GET["region"];
$password = $_GET["password"];
 
$resp = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY,
$_SERVER["REMOTE_ADDR"],
@@ -55,48 +29,44 @@
$_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;
}
$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;
}
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();
}
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) {
$oar_path = '/var/lib/oar/'.$region.'/'.$region.'.oar';
if (file_exists($oar_path)) {
header('Content-Description: File Transfer');
header('Content-Type: application/x-gzip-compressed');
header('Content-Disposition: attachment; filename='.basename($oar_path));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: '.filesize($oar_path));
readfile($oar_path);
exit;
}
}
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) {
$oar_path = '/var/lib/oar/'.$region.'.oar';
if (file_exists($oar_path)) {
if (false !== ($handler = fopen($oar_path, 'r'))) {
header('Content-Description: File Transfer');
header('Content-Type: application/x-gzip-compressed');
header('Content-Disposition: attachment; filename='.basename($oar_path));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: '.filesize($oar_path));
while (false !== ($chunk = fread($handler, 4096))) {
echo $chunk;
}
}
exit;
}
}
}
}
}
 
echo '<p>Sorry, incorrect captcha. Please try again.</p>';
echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>';