clockwerk-www – Diff between revs 57 and 67
?pathlinks?
Rev 57 | Rev 67 | |||
---|---|---|---|---|
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 | $file = $_FILES["file"]["tmp_name"]; |
14 | $file = $_FILES["file"]["tmp_name"]; |
|
15 | $password = $_POST["password"]; |
15 | $password = $_POST["password"]; |
|
16 | |
16 | |
|
17 | $resp = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, |
17 | $resp = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, |
|
18 | $_SERVER["REMOTE_ADDR"], |
18 | $_SERVER["REMOTE_ADDR"], |
|
19 | $_POST["recaptcha_challenge_field"], |
19 | $_POST["recaptcha_challenge_field"], |
|
20 | $_POST["recaptcha_response_field"]); |
20 | $_POST["recaptcha_response_field"]); |
|
21 | |
21 | |
|
22 | ?> |
22 | ?> |
|
23 | |
23 | |
|
24 | <!DOCTYPE html> |
24 | <!DOCTYPE html> |
|
25 | <html> |
25 | <html> |
|
26 | <head> |
26 | <head> |
|
27 | <title>Clockwerk</title> |
27 | <title>Clockwerk</title> |
|
28 | <link rel="stylesheet" href="css/gray.css" type="text/css" /> |
28 | <link rel="stylesheet" href="css/gray.css" type="text/css" /> |
|
29 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
29 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|
30 | </head> |
30 | </head> |
|
31 | <body class=dark-grey> |
31 | <body class=dark-grey> |
|
32 | <div class="center"> |
32 | <div class="center"> |
|
33 | <img src="img/clockwerk-logo.png" alt="logo"> |
33 | <img src="img/clockwerk-logo.png" alt="logo"> |
|
34 | <h1><?php print gethostname(); ?></h1> |
34 | <h1><?php print gethostname(); ?></h1> |
|
35 | <hr> |
35 | <hr> |
|
36 | |
36 | |
|
37 | <?php |
37 | <?php |
|
38 | |
38 | |
|
39 | switch((bool)$resp->is_valid) { |
39 | switch((bool)$resp->is_valid) { |
|
40 | case TRUE: |
40 | case TRUE: |
|
41 | $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
41 | $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
|
42 | $ret = $req->admin_authenticate_user($first, $last, MD5($password), '1'); |
42 | $ret = $req->admin_authenticate_user($first, $last, MD5($password), '1'); |
|
43 | $rep = new SimpleXMLElement($ret); |
43 | $rep = new SimpleXMLElement($ret); |
|
44 | foreach($rep->params->param->value->struct->member as $member) { |
44 | foreach($rep->params->param->value->struct->member as $member) { |
|
45 | switch($member->name) { |
45 | switch($member->name) { |
|
46 | case "success": |
46 | case "success": |
|
47 | switch((bool)$member->value->boolean) { |
47 | switch((bool)$member->value->boolean) { |
|
48 | case TRUE: |
48 | case TRUE: |
|
49 | if (file_exists($file)) { |
49 | if (file_exists($file)) { |
|
50 | chmod($file, 0644); |
50 | chmod($file, 0644); |
|
51 | $req->admin_console_command('load iar -m '.$first. ' '.$last.' / '.$file); |
51 | $req->admin_console_command('load iar -m '.$first. ' '.$last.' / '.$file); |
|
52 | chmod($file, 0600); |
52 | chmod($file, 0600); |
|
53 | echo '<p>IAR uploaded successfully.</p>'; |
53 | echo '<p>IAR uploaded successfully.</p>'; |
|
54 | } |
54 | } |
|
55 | goto last; |
55 | goto last; |
|
56 | default: |
56 | default: |
|
57 | echo '<p>Sorry, wrong password.</p>'; |
57 | echo '<p>Sorry, wrong password.</p>'; |
|
58 | goto last; |
58 | goto last; |
|
59 | } |
59 | } |
|
60 | break; |
60 | break; |
|
61 | } |
61 | } |
|
62 | } |
62 | } |
|
63 | default: |
63 | default: |
|
64 | echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; |
64 | echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; |
|
65 | } |
65 | } |
|
66 | |
66 | |
|
67 | last: |
67 | last: |
|
68 | |
68 | |
|
69 | ?> |
69 | ?> |
|
70 | <p> |
70 | |
|
- | 71 | <form class="dark-grey"> |
||
71 | <a class="button" href="welcome.php">Main Page</a> |
72 | <input type="button" onclick="parent.location='welcome.php'" value="Main Page"> |
|
72 | </p> |
73 | </form> |
|
73 | </div> |
74 | </div> |
|
74 | </body> |
75 | </body> |
|
75 | </html> |
76 | </html> |
|
76 | |
77 | |
|
77 | |
78 | |