clockwerk-www – Diff between revs 70 and 72

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 70 Rev 72
Line 53... Line 53...
53 if ($member->name == "success" && $member->value->boolean == "0") { 53 if ($member->name == "success" && $member->value->boolean == "0") {
54 echo 'Sorry, wrong password.'; 54 echo 'Sorry, wrong password.';
55 goto last; 55 goto last;
56 } 56 }
57 } 57 }
58 /* try { 58 try {
59 $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);
60 $mysql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 60 $mysql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
61 $query = $mysql->prepare("SELECT Name FROM land WHERE OwnerUUID=(SELECT PrincipalID FROM UserAccounts WHERE FirstName=:first AND LastName=:last)"); 61 $query = $mysql->prepare("SELECT UserLevel FROM UserAccounts WHERE FirstName=:first AND LastName=:last");
62 $query->bindParam(':first', $first); 62 $query->bindParam(':first', $first);
63 $query->bindParam(':last', $last); 63 $query->bindParam(':last', $last);
64 $query->execute(); 64 $query->execute();
-   65 $result=$query->fetch(PDO::FETCH_ASSOC);
65 } 66 }
66 catch(PDOException $e) { 67 catch(PDOException $e) {
67 print 'The given agent is not the owner of the region to download.'; 68 print '<p>Sorry, a database error occurred.</p>';
68 return 1; 69 goto last;
69 } 70 }
70 while ($result = $query->fetchObject()) { 71 if($result['UserLevel'] < 100) {
71 if ($result->RegionName == $region) { */ 72 print '<p>Sorry, the authenticated agent does not have the necessary level to download OARs.</p>';
-   73 goto last;
-   74 }
72 $oar_path = '/var/lib/oar/'.$region.'/'.$region.'.oar'; 75 $oar_path = '/var/lib/oar/'.$region.'/'.$region.'.oar';
73 if (file_exists($oar_path)) { 76 if (file_exists($oar_path)) {
74 header('Content-Description: File Transfer'); 77 header('Content-Description: File Transfer');
75 header('Content-Type: application/x-gzip-compressed'); 78 header('Content-Type: application/x-gzip-compressed');
76 header('Content-Disposition: attachment; filename='.basename($oar_path)); 79 header('Content-Disposition: attachment; filename='.basename($oar_path));
77 header('Content-Transfer-Encoding: binary'); 80 header('Content-Transfer-Encoding: binary');
78 header('Expires: 0'); 81 header('Expires: 0');
79 header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); 82 header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
80 header('Pragma: public'); 83 header('Pragma: public');
81 header('Content-Length: '.filesize($oar_path)); 84 header('Content-Length: '.filesize($oar_path));
82 readfile($oar_path); 85 readfile($oar_path);
83 goto last; 86 goto last;
84 } 87 }
85 echo '<p>Sorry, the OAR file is not available yet.</p>'; 88 echo '<p>Sorry, the OAR file is not available yet.</p>';
86 goto last; 89 goto last;
87 /* } -  
88 } */ -  
89 } 90 }
Line 90... Line 91...
90   91  
Line 91... Line 92...
91 echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>'; 92 echo '<p>Sorry, incorrect CAPTCHA. Please try again.</p>';