clockwerk-www – Diff between revs 57 and 58
?pathlinks?
Rev 57 | Rev 58 | |||
---|---|---|---|---|
1 | <?php |
1 | <?php |
|
2 | |
2 | |
|
3 | /////////////////////////////////////////////////////////////////////////// |
3 | /////////////////////////////////////////////////////////////////////////// |
|
4 | // Copyright (C) Wizardry and Steamworks 2014 - License: MIT // |
4 | // Copyright (C) Wizardry and Steamworks 2014 - License: MIT // |
|
5 | /////////////////////////////////////////////////////////////////////////// |
5 | /////////////////////////////////////////////////////////////////////////// |
|
6 | |
6 | |
|
7 | require_once 'lib/recaptchalib.php'; |
7 | require_once 'lib/recaptchalib.php'; |
|
8 | require_once 'lib/wasRemoteAdmin.php'; |
8 | require_once 'lib/wasRemoteAdmin.php'; |
|
9 | |
9 | |
|
10 | define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr'); |
10 | define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr'); |
|
11 | |
11 | |
|
12 | $first = $_POST["first"]; |
12 | $first = $_POST["first"]; |
|
13 | $last = $_POST["last"]; |
13 | $last = $_POST["last"]; |
|
14 | $password = $_POST["password"]; |
14 | $password = $_POST["password"]; |
|
15 | |
15 | |
|
16 | $resp=recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, |
16 | $resp=recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, |
|
17 | $_SERVER["REMOTE_ADDR"], |
17 | $_SERVER["REMOTE_ADDR"], |
|
18 | $_POST["recaptcha_challenge_field"], |
18 | $_POST["recaptcha_challenge_field"], |
|
19 | $_POST["recaptcha_response_field"]); |
19 | $_POST["recaptcha_response_field"]); |
|
20 | |
20 | |
|
21 | ?> |
21 | ?> |
|
22 | |
22 | |
|
23 | <!DOCTYPE html> |
23 | <!DOCTYPE html> |
|
24 | <html> |
24 | <html> |
|
25 | <head> |
25 | <head> |
|
26 | <title>Clockwerk</title> |
26 | <title>Clockwerk</title> |
|
27 | <link rel="stylesheet" href="css/gray.css" type="text/css" /> |
27 | <link rel="stylesheet" href="css/gray.css" type="text/css" /> |
|
28 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
28 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
29 | </head> |
29 | </head> |
|
30 | <body class=dark-grey> |
30 | <body class=dark-grey> |
|
31 | <div class="center"> |
31 | <div class="center"> |
|
32 | <img src="img/clockwerk-logo.png" alt="logo"> |
32 | <img src="img/clockwerk-logo.png" alt="logo"> |
|
33 | <h1><?php print gethostname(); ?></h1> |
33 | <h1><?php print gethostname(); ?></h1> |
|
34 | <hr> |
34 | <hr> |
|
35 | |
35 | |
|
36 | <?php |
36 | <?php |
|
37 | |
37 | |
|
38 | if($resp->is_valid) { |
38 | if($resp->is_valid) { |
|
39 | $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
39 | $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
|
40 | $ret = $req->admin_authenticate_user($first, $last, MD5($password), '1'); |
40 | $ret = $req->admin_authenticate_user($first, $last, MD5($password), '1'); |
|
41 | $rep = new SimpleXMLElement($ret); |
41 | $rep = new SimpleXMLElement($ret); |
|
42 | foreach($rep->params->param->value->struct->member as $member) { |
42 | foreach($rep->params->param->value->struct->member as $member) { |
|
43 | if($member->name == "success" && $member->value->boolean == "0") { |
43 | if($member->name == "success" && $member->value->boolean == "0") { |
|
44 | echo 'Sorry, wrong password.'; |
44 | echo 'Sorry, wrong password.'; |
|
45 | exit; |
45 | goto last; |
|
46 | } |
46 | } |
|
47 | } |
47 | } |
|
48 | $iar_path = '/var/lib/iar/'.$first.'_'.$last.'/'.$first.'_'.$last.'.iar'; |
48 | $iar_path = '/var/lib/iar/'.$first.'_'.$last.'/'.$first.'_'.$last.'.iar'; |
|
49 | if (file_exists($iar_path)) { |
49 | if (file_exists($iar_path)) { |
|
50 | header('Content-Description: File Transfer'); |
50 | header('Content-Description: File Transfer'); |
|
51 | header('Content-Type: application/x-gzip-compressed'); |
51 | header('Content-Type: application/x-gzip-compressed'); |
|
52 | header('Content-Disposition: attachment; filename='.basename($iar_path)); |
52 | header('Content-Disposition: attachment; filename='.basename($iar_path)); |
|
53 | header('Content-Transfer-Encoding: binary'); |
53 | header('Content-Transfer-Encoding: binary'); |
|
54 | header('Expires: 0'); |
54 | header('Expires: 0'); |
|
55 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
55 | header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); |
|
56 | header('Pragma: public'); |
56 | header('Pragma: public'); |
|
57 | header('Content-Length: '.filesize($iar_path)); |
57 | header('Content-Length: '.filesize($iar_path)); |
|
58 | readfile($iar_path); |
58 | readfile($iar_path); |
|
59 | exit; |
59 | goto last; |
|
60 | } |
60 | } |
|
- | 61 | echo '<p>Sorry, your IAR file is not available yet.</p>'; |
||
- | 62 | goto last; |
||
61 | } |
63 | } |
|
62 | |
64 | |
|
63 | echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; |
65 | echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; |
|
- | 66 | |
||
- | 67 | last; |
||
64 | |
68 | |
|
65 | ?> |
69 | ?> |
|
66 | |
70 | |
|
67 | <p> |
71 | <p> |
|
68 | <a class="button" href="welcome.php">Main Page</a> |
72 | <a class="button" href="welcome.php">Main Page</a> |
|
69 | </p> |
73 | </p> |
|
70 | </div> |
74 | </div> |
|
71 | </body> |
75 | </body> |
|
72 | </html> |
76 | </html> |
|
73 | |
77 | |
|
74 | |
78 | |