clockwerk-www – Diff between revs 55 and 57

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 55 Rev 57
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 </head> 30 </head>
30 <body class=dark-grey> 31 <body class=dark-grey>
31 <div class="center"> 32 <div class="center">
32 <img src="img/clockwerk-logo.png"> 33 <img src="img/clockwerk-logo.png" alt="logo">
33 <h1><?php print gethostname(); ?></h1> 34 <h1><?php print gethostname(); ?></h1>
34 <hr> 35 <hr>
35   36  
36 <?php 37 <?php
37   38  
38 switch((bool)$resp->is_valid) { 39 switch((bool)$resp->is_valid) {
39 case TRUE: 40 case TRUE:
40 $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); 41 $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim');
41 $ret = $req->admin_authenticate_user($first, $last, MD5($password), '1'); 42 $ret = $req->admin_authenticate_user($first, $last, MD5($password), '1');
42 $rep = new SimpleXMLElement($ret); 43 $rep = new SimpleXMLElement($ret);
43 foreach($rep->params->param->value->struct->member as $member) { 44 foreach($rep->params->param->value->struct->member as $member) {
44 switch($member->name) { 45 switch($member->name) {
45 case "success": 46 case "success":
46 switch((bool)$member->value->boolean) { 47 switch((bool)$member->value->boolean) {
47 case TRUE: 48 case TRUE:
48 if (file_exists($file)) { 49 if (file_exists($file)) {
49 chmod($file, 0644); 50 chmod($file, 0644);
50 $req->admin_console_command('load iar -m '.$first. ' '.$last.' / '.$file); 51 $req->admin_console_command('load iar -m '.$first. ' '.$last.' / '.$file);
51 chmod($file, 0600); 52 chmod($file, 0600);
52 echo '<p>IAR uploaded successfully.</p>'; 53 echo '<p>IAR uploaded successfully.</p>';
53 } 54 }
54 goto last; 55 goto last;
55 default: 56 default:
56 echo '<p>Sorry, wrong password.</p>'; 57 echo '<p>Sorry, wrong password.</p>';
57 goto last; 58 goto last;
58 } 59 }
59 break; 60 break;
60 } 61 }
61 } 62 }
62 default: 63 default:
63 echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; 64 echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>';
64 } 65 }
65   66  
66 last: 67 last:
67   68  
68 ?> 69 ?>
69 <p> 70 <p>
70 <a class="button" href="welcome.php">Main Page</a> 71 <a class="button" href="welcome.php">Main Page</a>
71 </p> 72 </p>
72 </div> 73 </div>
73 </body> 74 </body>
74 </html> 75 </html>
75   76  
76   77