opensim-www

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 4  →  ?path2? @ 5
/download.php
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html>
<link rel="stylesheet" href="css/green.css" type="text/css" />
<body>
<div>
<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="sendiar.php"><div class="title"></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-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 style="float:left;">
<input type="submit" class="so_button" style="color:#fff;line-height:0px;" value="Download">
</div>
<div>
<a class="so_button" style="color:#fff" href="welcome.php">Cancel</a>
</div>
</form>
<script type="text/javascript" src="lib/green.js"></script>
 
</div>
</body>
</html>
/lib/kos_authenticate.php
@@ -0,0 +1,103 @@
<?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_Authenticate {
var $url;
var $pwd;
function KOS_Authenticate($url,$pwd) {
$this->url = $url;
$this->pwd = $pwd;
}
function authenticate($firstname, $lastname, $password, $tokentime) {
$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_authenticate_user'),
"params" =>
array( "param" =>
array( "value" =>
array("struct" =>
array(
"member" =>
array(
"name" => 'password',
"value" => array(
"string" => htmlspecialchars($this->pwd)
),
),
array(
"name" => 'user_firstname',
"value" => htmlspecialchars($firstname)
),
array(
"name" => 'user_lastname',
"value" => htmlspecialchars($lastname)
),
array(
"name" => 'user_password',
"value" => htmlspecialchars($password)
),
array(
"name" => 'token_lifetime',
"value" => htmlspecialchars($tokentime)
),
),
),
),
),
);
$serializer->serialize($xml);
$xml_load = $serializer->getSerializedData();
$request->setBody($xml_load);
return $request->send()->getBody();
}
}
?>
/sendiar.php
@@ -0,0 +1,40 @@
<?php
 
require_once 'lib/recaptchalib.php';
require_once 'lib/kos_authenticate.php';
 
define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr');
$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"]);
 
if($resp->is_valid) {
$req = new KOS_Authenticate('http://127.0.0.1:10000', 'opensim');
$ret = $req->authenticate($first, $last, MD5($password), '1');
$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;
}
}
exit;
}
}
echo '<p>Sorry, incorrect captcha. Please try again.</p>';
/welcome.php
@@ -4,11 +4,9 @@
<body>
<div>
<img src="img/spectacledowl-logo.png">
<p>
<a class="so_button" href="register.php">Create a New Account</a>
<a class="so_button" href="about.php">About</a>
<a class="so_button" href="personal.php">Personal</a>
</p>
<p><a class="so_button" href="register.php">Create a New Account</a></p>
<p><a class="so_button" href="about.php">About</a></p>
<p><a target="_blank" class="so_button" href="download.php">Get IAR</a></p>
</body>
</html>