clockwerk-www – Diff between revs 55 and 57
?pathlinks?
Rev 55 | Rev 57 | |||
---|---|---|---|---|
1 | <?php |
1 | <?php |
|
2 | |
2 | |
|
3 | require_once 'lib/recaptchalib.php'; |
3 | require_once 'lib/recaptchalib.php'; |
|
4 | require_once 'lib/wasRemoteAdmin.php'; |
4 | require_once 'lib/wasRemoteAdmin.php'; |
|
5 | require_once 'lib/uuid.php'; |
5 | require_once 'lib/uuid.php'; |
|
6 | |
6 | |
|
7 | define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr'); |
7 | define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr'); |
|
8 | |
8 | |
|
9 | ?> |
9 | ?> |
|
10 | <!DOCTYPE html> |
10 | <!DOCTYPE html> |
|
11 | <html> |
11 | <html> |
|
12 | <head> |
12 | <head> |
|
13 | <title>Clockwerk</title> |
13 | <title>Clockwerk</title> |
|
14 | <link rel="stylesheet" href="css/green.css" type="text/css" /> |
14 | <link rel="stylesheet" href="css/green.css" type="text/css" /> |
|
- | 15 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
||
15 | </head> |
16 | </head> |
|
16 | <body class="dark-grey"> |
17 | <body class="dark-grey"> |
|
17 | <div> |
18 | <div> |
|
18 | <img src="img/clockwerk-logo.png"> |
19 | <img src="img/clockwerk-logo.png" alt="logo"> |
|
19 | <h1><?php print gethostname(); ?></h1> |
20 | <h1><?php print gethostname(); ?></h1> |
|
20 | <hr> |
21 | <hr> |
|
21 | <p> |
22 | <p> |
|
22 | <?php |
23 | <?php |
|
23 | |
24 | |
|
24 | $first = $_POST["first"]; |
25 | $first = $_POST["first"]; |
|
25 | $last = $_POST["last"]; |
26 | $last = $_POST["last"]; |
|
26 | $password = $_POST["password"]; |
27 | $password = $_POST["password"]; |
|
27 | $email = $_POST["email"]; |
28 | $email = $_POST["email"]; |
|
28 | |
29 | |
|
29 | $resp=recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, |
30 | $resp=recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY, |
|
30 | $_SERVER["REMOTE_ADDR"], |
31 | $_SERVER["REMOTE_ADDR"], |
|
31 | $_POST["recaptcha_challenge_field"], |
32 | $_POST["recaptcha_challenge_field"], |
|
32 | $_POST["recaptcha_response_field"]); |
33 | $_POST["recaptcha_response_field"]); |
|
33 | |
34 | |
|
34 | switch((bool)$resp->is_valid) { |
35 | switch((bool)$resp->is_valid) { |
|
35 | case TRUE: |
36 | case TRUE: |
|
36 | $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
37 | $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim'); |
|
37 | $uuid = UUID::v4(); |
38 | $uuid = UUID::v4(); |
|
38 | $ret = $req->admin_create_user($first, $last, $password, '128', '128'); |
39 | $ret = $req->admin_create_user($first, $last, $password, '128', '128'); |
|
39 | $rep = new SimpleXMLElement($ret); |
40 | $rep = new SimpleXMLElement($ret); |
|
40 | foreach($rep->params->param->value->struct->member as $member) { |
41 | foreach($rep->params->param->value->struct->member as $member) { |
|
41 | switch($member->name) { |
42 | switch($member->name) { |
|
42 | case "success": |
43 | case "success": |
|
43 | switch(boolval($member->value->boolean)) { |
44 | switch(boolval($member->value->boolean)) { |
|
44 | case TRUE: |
45 | case TRUE: |
|
45 | echo '<p>Account created successfully.</p>'; |
46 | echo '<p>Account created successfully.</p>'; |
|
46 | goto last; |
47 | goto last; |
|
47 | default: |
48 | default: |
|
48 | echo '<p>Sorry, the account could not be created.</p>'; |
49 | echo '<p>Sorry, the account could not be created.</p>'; |
|
49 | goto last; |
50 | goto last; |
|
50 | } |
51 | } |
|
51 | break; |
52 | break; |
|
52 | } |
53 | } |
|
53 | } |
54 | } |
|
54 | break; |
55 | break; |
|
55 | default: |
56 | default: |
|
56 | echo '<p>Sorry, incorrect captcha. Please try again.</p>'; |
57 | echo '<p>Sorry, incorrect captcha. Please try again.</p>'; |
|
57 | } |
58 | } |
|
58 | |
59 | |
|
59 | last: |
60 | last: |
|
60 | |
61 | |
|
61 | ?> |
62 | ?> |
|
62 | </p> |
63 | </p> |
|
63 | <p> |
64 | <p> |
|
64 | <a class="button" href="register.php">Create a New Account</a> |
65 | <a class="button" href="register.php">Create a New Account</a> |
|
65 | <a class="button" href="welcome.php">Main Page</a> |
66 | <a class="button" href="welcome.php">Main Page</a> |
|
66 | </p> |
67 | </p> |
|
67 | </div> |
68 | </div> |
|
68 | </div> |
69 | </div> |
|
69 | </body> |
70 | </body> |
|
70 | </html> |
71 | </html> |
|
71 | |
72 | |