Added lot of junk laying around on harvie.cz
[mirrors/Programs.git] / php / encfs / encfs.php
diff --git a/php/encfs/encfs.php b/php/encfs/encfs.php
new file mode 100755 (executable)
index 0000000..8852893
--- /dev/null
@@ -0,0 +1,53 @@
+<?php
+require_once('./php-encfs.php');
+
+$encrypted = '/mnt/data1/domains/kyberia.cz/encfs/a';          //encfs encrypted data
+$plaintext = '/mnt/data1/domains/kyberia.cz/encfs/b';          //plaintext mountpoint
+$umountpasswd = '';                    //password for unmounting (can't be same as mounting password)
+$encfsargs = '--public';               //arguments passed to encfs
+
+?>
+<h1><a href="?">EncFS Web Interface</a></h1>
+<?php echo("encfs '<b>$encrypted</b>' '$plaintext' $encfsargs<br /><br />"); ?>
+
+<style>/*<!--*/
+input {
+       width:200px;
+}
+/*-->*/</style>
+
+<form action="?" method="POST">
+       <input type="submit" value="MOUNT (DECRYPT)" />
+       <input type="password" name="mnt" value="" />
+</form>
+<form action="?" method="POST">
+       <input type="submit" value="UNMOUNT (ENCRYPT)" />
+       <input type="password" name="umnt" value="" />
+</form>
+Brougt to you by <a href="http://blog.harvie.cz/">Harvie</a> 2oo9!
+
+<br /><pre>
+<?php
+
+if(isset($_POST['mnt']) && isset($_POST['umnt']))
+       die('Error: Cannot do both mount and umount!');
+
+if(isset($_POST['mnt'])) {
+       if($_POST['mnt'] == $umountpasswd)
+               die('Error: It is VERY dangerous to have same mount nad unmount password!!! Change it!');
+       if(trim($_POST['mnt']) == '')
+               die('Error: Mount password cannot be empty!!! Change it!');
+
+       encfs_mount($encrypted, $plaintext, $_POST['mnt'], $encfsargs);
+}
+
+if(isset($_POST['umnt'])) {
+       if($_POST['umnt'] == $umountpasswd) {
+               encfs_unmount($plaintext);
+       } else {
+               echo('Error: Invalid unmount password. You can change it in .php file.');
+       }
+}
+
+?>
+</pre>
This page took 0.119954 seconds and 4 git commands to generate.