docs
[mirrors/Programs.git] / php / encfs / encfs.php
CommitLineData
8de51304
H
1<?php
2require_once('./php-encfs.php');
3
4$encrypted = '/mnt/data1/domains/kyberia.cz/encfs/a'; //encfs encrypted data
5$plaintext = '/mnt/data1/domains/kyberia.cz/encfs/b'; //plaintext mountpoint
6$umountpasswd = ''; //password for unmounting (can't be same as mounting password)
7$encfsargs = '--public'; //arguments passed to encfs
8
9?>
10<h1><a href="?">EncFS Web Interface</a></h1>
11<?php echo("encfs '<b>$encrypted</b>' '$plaintext' $encfsargs<br /><br />"); ?>
12
13<style>/*<!--*/
14input {
15 width:200px;
16}
17/*-->*/</style>
18
19<form action="?" method="POST">
20 <input type="submit" value="MOUNT (DECRYPT)" />
21 <input type="password" name="mnt" value="" />
22</form>
23<form action="?" method="POST">
24 <input type="submit" value="UNMOUNT (ENCRYPT)" />
25 <input type="password" name="umnt" value="" />
26</form>
27Brougt to you by <a href="http://blog.harvie.cz/">Harvie</a> 2oo9!
28
29<br /><pre>
30<?php
31
32if(isset($_POST['mnt']) && isset($_POST['umnt']))
33 die('Error: Cannot do both mount and umount!');
34
35if(isset($_POST['mnt'])) {
36 if($_POST['mnt'] == $umountpasswd)
37 die('Error: It is VERY dangerous to have same mount nad unmount password!!! Change it!');
38 if(trim($_POST['mnt']) == '')
39 die('Error: Mount password cannot be empty!!! Change it!');
40
41 encfs_mount($encrypted, $plaintext, $_POST['mnt'], $encfsargs);
42}
43
44if(isset($_POST['umnt'])) {
45 if($_POST['umnt'] == $umountpasswd) {
46 encfs_unmount($plaintext);
47 } else {
48 echo('Error: Invalid unmount password. You can change it in .php file.');
49 }
50}
51
52?>
53</pre>
This page took 0.16822 seconds and 4 git commands to generate.