opensim-www – Diff between revs 9 and 10

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 9 Rev 10
1 <?php 1 <?php
2   2  
3 require_once 'lib/recaptchalib.php'; 3 require_once 'lib/recaptchalib.php';
4 require_once 'lib/kos_authenticate.php'; 4 require_once 'lib/wasRemoteAdmin.php';
5   5  
6 define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr'); 6 define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr');
7 7
8 $first = $_POST["first"]; 8 $first = $_POST["first"];
9 $last = $_POST["last"]; 9 $last = $_POST["last"];
10 $password = $_POST["password"]; 10 $password = $_POST["password"];
11   11  
12 $resp=recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, 12 $resp=recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY,
13 $_SERVER["REMOTE_ADDR"], 13 $_SERVER["REMOTE_ADDR"],
14 $_POST["recaptcha_challenge_field"], 14 $_POST["recaptcha_challenge_field"],
15 $_POST["recaptcha_response_field"]); 15 $_POST["recaptcha_response_field"]);
16   16  
17 if($resp->is_valid) { 17 if($resp->is_valid) {
18 $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); 18 $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim');
19 $ret = $req->admin_authenticate_user($first, $last, MD5($password), '1'); 19 $ret = $req->admin_authenticate_user($first, $last, MD5($password), '1');
20 $rep = new SimpleXMLElement($ret); 20 $rep = new SimpleXMLElement($ret);
21 foreach($rep->params->param->value->struct->member as $member) { 21 foreach($rep->params->param->value->struct->member as $member) {
22 if($member->name == "success" && $member->value->boolean == "0") { 22 if($member->name == "success" && $member->value->boolean == "0") {
23 echo 'Sorry, wrong password.'; 23 echo 'Sorry, wrong password.';
24 exit; 24 exit;
25 } 25 }
26 } 26 }
27 $iar_path = '/var/lib/iar/'.$first.'_'.$last.'/'.$first.'_'.$last.'.iar'; 27 $iar_path = '/var/lib/iar/'.$first.'_'.$last.'/'.$first.'_'.$last.'.iar';
28 if(file_exists($iar_path)) { 28 if(file_exists($iar_path)) {
29 if(false !== ($handler = fopen($iar_path, 'r'))) { 29 if(false !== ($handler = fopen($iar_path, 'r'))) {
30 header('Content-Description: File Transfer'); 30 header('Content-Description: File Transfer');
31 header('Content-Type: application/x-gzip-compressed'); 31 header('Content-Type: application/x-gzip-compressed');
32 header('Content-Disposition: attachment; filename='.basename($iar_path)); 32 header('Content-Disposition: attachment; filename='.basename($iar_path));
33 header('Content-Transfer-Encoding: binary'); 33 header('Content-Transfer-Encoding: binary');
34 header('Expires: 0'); 34 header('Expires: 0');
35 header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 35 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
36 header('Pragma: public'); 36 header('Pragma: public');
37 header('Content-Length: '.filesize($iar_path)); 37 header('Content-Length: '.filesize($iar_path));
38 38
39 while(false !== ($chunk = fread($handler, 4096))) { 39 while(false !== ($chunk = fread($handler, 4096))) {
40 echo $chunk; 40 echo $chunk;
41 } 41 }
42 } 42 }
43 exit; 43 exit;
44 } 44 }
45 } 45 }
46 46
47 echo '<p>Sorry, incorrect captcha. Please try again.</p>'; 47 echo '<p>Sorry, incorrect captcha. Please try again.</p>';
48   48  
49   49