예제 #1
0
파일: status.php 프로젝트: vishnuvp/toyapp
	<div class="file-display-id">
		File <?php 
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    $_GET['f'] = $_POST['fid'];
}
echo $_GET['f'];
?>
	</div>
		<?php 
#TODO: AUTHENTICATE SHAREHOLDER
require_once "../includes/shareholdersapi.inc";
$current = get_user_info()['uid'];
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    confirm_share($current, $_POST['fid']);
}
$shareholders = get_shareholders($_GET['f']);
$status = array(0 => ' not confirmed yet', 1 => ' confirmed');
?>
		
		<?php 
$my_status = '';
foreach ($shareholders as $row) {
    if ($row['uid'] != $current) {
        ?>
			<div class="shareholder-row"><?php 
        echo $row['name'] . '[' . $row['uid'] . '] has ' . $status[$row['status']];
        ?>
</div>
			<?php 
    } else {
        if ($row['uid'] == $current) {
예제 #2
0
    //$inputFileName = $_FILES['file']['name'];
    echo '<div style="color:#005387">Uploading..</div>';
    $sent = explode(';', $_POST['data']);
    $N = $sent[0];
    $K = $sent[1];
    $command = '/usr/bin/python /var/www/html/toyapp/toyapp-python/toyapp.py encrypt ' . $file_name . ' ' . $N . ' ' . $K;
    echo $command;
    //echo '<br />'.$command;
    //echo '<br />';
    #$result = #exec($command);#
    $result = json_decode(exec($command, $status), true);
    $size = sizeof($result);
    //print_r($result);
    $i = 0;
    require_once '../includes/shareholdersapi.inc';
    $shareholders = get_shareholders($sent[2]);
    //print_r($shareholders);
    require_once '../includes/DB_Abstraction.inc';
    $db_con = new DBConnection();
    $db_con->connect();
    foreach ($result as $pair) {
        $uid = $shareholders[$i]['uid'];
        $db_con->insert('secrets', 'fid,uid,secret', "{$sent['2']},'{$uid}','[{$pair['0']},{$pair['1']}]'");
        $i++;
        echo "<br />Secret {$i}: <input type='text' readonly='readonly' value='[{$pair['0']},{$pair['1']}]'/>";
    }
    //print_r($result);//. ' <br />';
    $db_con->update('file', "url='\\/toyapp\\/repo\\/{$fn}.enc',status=2", "fid={$sent['2']}");
    $db_con->disconnect();
    //unlink($file_name);
}