opensim-www
/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>'; |