clockwerk-www – Diff between revs 53 and 55
?pathlinks?
Rev 53 | Rev 55 | |||
---|---|---|---|---|
Line 27... | Line 27... | |||
27 | $resp = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, |
27 | $resp = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, |
|
28 | $_SERVER["REMOTE_ADDR"], |
28 | $_SERVER["REMOTE_ADDR"], |
|
29 | $_POST["recaptcha_challenge_field"], |
29 | $_POST["recaptcha_challenge_field"], |
|
30 | $_POST["recaptcha_response_field"]); |
30 | $_POST["recaptcha_response_field"]); |
|
Line -... | Line 31... | |||
- | 31 | |
||
- | 32 | ?> |
||
- | 33 | |
||
- | 34 | <!DOCTYPE html> |
||
- | 35 | <html> |
||
- | 36 | <head> |
||
- | 37 | <title>Clockwerk</title> |
||
- | 38 | <link rel="stylesheet" href="css/gray.css" type="text/css" /> |
||
- | 39 | </head> |
||
- | 40 | <body class=dark-grey> |
||
- | 41 | <div class="center"> |
||
- | 42 | <img src="img/clockwerk-logo.png"> |
||
- | 43 | <h1><?php print gethostname(); ?></h1> |
||
- | 44 | <hr> |
||
- | 45 | |
||
- | 46 | <?php |
||
31 | |
47 | |
|
- | 48 | switch((bool)$resp->is_valid) { |
||
32 | if ($resp->is_valid) { |
49 | case TRUE: |
|
33 | $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
50 | $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
|
34 | $ret = $req->admin_authenticate_user($first, $last, MD5($password), '1'); |
51 | $ret = $req->admin_authenticate_user($first, $last, MD5($password), '1'); |
|
35 | $rep = new SimpleXMLElement($ret); |
52 | $rep = new SimpleXMLElement($ret); |
|
36 | foreach($rep->params->param->value->struct->member as $member) { |
53 | foreach($rep->params->param->value->struct->member as $member) { |
|
37 | if ($member->name == "success" && $member->value->boolean == "0") { |
54 | switch($member->name) { |
|
- | 55 | case "success": |
||
38 | echo 'Sorry, wrong password.'; |
56 | switch((bool)$member->value->boolean) { |
|
39 | exit; |
- | ||
40 | } |
- | ||
41 | } |
57 | case TRUE: |
|
42 | try { |
58 | try { |
|
43 | $mysql = new PDO('mysql:host='.$MYSQL_HOSTNAME.';dbname='.$MYSQL_DATABASE.';', $MYSQL_USERNAME, $MYSQL_PASSWORD); |
59 | $mysql = new PDO('mysql:host='.$MYSQL_HOSTNAME.';dbname='.$MYSQL_DATABASE.';', $MYSQL_USERNAME, $MYSQL_PASSWORD); |
|
44 | $mysql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
60 | $mysql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
|
45 | $query = $mysql->prepare("SELECT RegionName FROM regions WHERE owner_uuid=(SELECT PrincipalID FROM UserAccounts WHERE FirstName=:first AND LastName=:last)"); |
61 | $query = $mysql->prepare("SELECT RegionName FROM regions WHERE owner_uuid=(SELECT PrincipalID FROM UserAccounts WHERE FirstName=:first AND LastName=:last)"); |
|
46 | $query->bindParam(':first', $first); |
62 | $query->bindParam(':first', $first); |
|
47 | $query->bindParam(':last', $last); |
63 | $query->bindParam(':last', $last); |
|
48 | $query->execute(); |
64 | $query->execute(); |
|
49 | } |
65 | } |
|
50 | catch(PDOException $e) { |
66 | catch(PDOException $e) { |
|
- | 67 | print '<p>Sorry, the authenticated agent is not the owner of the region to download.</p>'; |
||
- | 68 | goto last; |
||
- | 69 | } |
||
- | 70 | while ($result = $query->fetchObject()) { |
||
- | 71 | if ($result->RegionName == $region) { |
||
- | 72 | if (file_exists($file)) { |
||
- | 73 | $req->admin_console_command('change region '.$region); |
||
- | 74 | chmod($file, 0644); |
||
- | 75 | $req->admin_console_command('load oar '.$file); |
||
- | 76 | chmod($file, 0600); |
||
- | 77 | echo '<p>OAR uploaded successfully.</p>'; |
||
- | 78 | goto last; |
||
- | 79 | } |
||
- | 80 | } |
||
- | 81 | } |
||
- | 82 | goto last; |
||
- | 83 | default: |
||
- | 84 | echo '<p>Sorry, wrong password.</p>'; |
||
51 | print 'The given agent is not the owner of the region to download.'; |
85 | goto last; |
|
- | 86 | } |
||
- | 87 | break; |
||
- | 88 | } |
||
- | 89 | } |
||
- | 90 | default: |
||
52 | return 1; |
91 | echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; |
|
53 | } |
- | ||
54 | while ($result = $query->fetchObject()) { |
- | ||
55 | if ($result->RegionName == $region) { |
- | ||
56 | if (file_exists($file)) { |
- | ||
57 | $req->admin_console_command('change region '.$region); |
- | ||
58 | chmod($file, 0644); |
- | ||
59 | $req->admin_console_command('load oar '.$file); |
- | ||
60 | chmod($file, 0600); |
- | ||
61 | header('Location: welcome.php'); |
- | ||
62 | exit; |
- | ||
63 | } |
- | ||
64 | } |
- | ||
65 | } |
- | ||
Line -... | Line 92... | |||
- | 92 | } |
||
- | 93 | |
||
- | 94 | last: |
||
- | 95 | |
||
- | 96 | ?> |
||
66 | } |
97 | |
|
- | 98 | <p> |
||
- | 99 | <a class="button" href="welcome.php">Main Page</a> |
||
- | 100 | </p> |
||
- | 101 | </div> |