clockwerk-www – Blame information for rev 50

Subversion Repositories:
Rev:
Rev Author Line No. Line
47 eva 1 <?php
2  
3 ///////////////////////////////////////////////////////////////////////////
4 // Copyright (C) Wizardry and Steamworks 2014 - License: MIT //
5 ///////////////////////////////////////////////////////////////////////////
6  
50 zed 7 ///////////////////////////////////////////////////////////////////////////
8 // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 //
9 ///////////////////////////////////////////////////////////////////////////
10 function wasChown($path, $uid, $gid) {
11 switch(filetype($path)) {
12 case 'dir':
13 if(($dir = opendir($path)) === false) break;
14 while(false !== ($file = readdir($dir))) {
15 if($file == '.' || $file == '..') continue;
16 wasChown($path.'/'.$file, $uid, $gid);
17 }
18 case 'file':
19 chown($path, $uid);
20 chgrp($path, $gid);
21 break;
22 }
23 }
24  
47 eva 25 require_once 'lib/recaptchalib.php';
26 require_once 'lib/wasRemoteAdmin.php';
27  
28 define('RECAPTCHA_PRIVATE_KEY', '6Lcz9ukSAAAAAC3u90rcOIdnNnaK_JgMjrOsSzZr');
29  
30 $first = $_POST["first"];
31 $last = $_POST["last"];
32 $file = $_FILES["file"]["tmp_name"];
33 $password = $_POST["password"];
34  
35 $resp = recaptcha_check_answer(RECAPTCHA_PRIVATE_KEY,
36 $_SERVER["REMOTE_ADDR"],
37 $_POST["recaptcha_challenge_field"],
38 $_POST["recaptcha_response_field"]);
39  
40 if ($resp->is_valid) {
41 $req = new wasRemoteAdmin('http://127.0.0.1:10000', 'opensim');
42 $ret = $req->admin_authenticate_user($first, $last, MD5($password), '1');
43 $rep = new SimpleXMLElement($ret);
44 foreach($rep->params->param->value->struct->member as $member) {
45 if ($member->name == "success" && $member->value->boolean == "0") {
46 echo 'Sorry, wrong password.';
47 exit;
48 }
49 }
50 if (file_exists($file)) {
50 zed 51 wasChown($file, 'opensim', 'opensim');
47 eva 52 $req->admin_console_command('load iar '.$file. ' '.$last.' / '.$file);
50 zed 53 wasChown($file, 'www-data', 'www-data');
47 eva 54 header('Location: welcome.php');
55 exit;
56 }
57 }
58  
59 echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>';