forked from royhodge/apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvault_download_process.php
More file actions
61 lines (47 loc) · 2.02 KB
/
Copy pathvault_download_process.php
File metadata and controls
61 lines (47 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
session_start();
ob_start();
require_once('check-login.php');
require_once('config.php');
require_once('resources.php');
require_once('helperFunctions.php');
try
{
if (isset($_POST['txid']))
{
$txId = $_POST['txid'];
$uploader_address = $_SESSION['address'];
$dbHelper = new DBHelper(null,null);
$transaction = $dbHelper->getAddressTransaction($uploader_address, $txId);
echo "<h3 style='color:#0066cc'><b><u>Transaction Details</u></b></h3>";
echo printStreamTransactionBasicDetailsVertically($transaction);
echo "<h3 style='color:#0066cc'><b><u>Data</u></b></h3>";
$vOut_n = -1;
$dataHex = $dbHelper->getDataFromDataItem($transaction['data'][0]);
$dataArr = json_decode(hex2bin($dataHex));
echo "<p><div class='table-responsive scrollable has-scrollbar scrollable-content ' data-plugin-scrollable><table class='table table-bordered table-hover table-condensed mb-none'>";
foreach ($dataArr as $key => $value) {
if ($key!='file_hex') {
echo "<tr><th style='border-style: ridge;'>".Literals::VAULT_FIELDS_DESC[$key]."</th><td style='border-style: ridge;'>".$value."</td></tr>";
}
}
$downloadFormHTML = "<form action='vault_file_download.php' method='post'>"."<input type='hidden' name='txid' value='".$txId."' />";
$downloadFormHTML .= ($vOut_n != -1) ? "<input type='hidden' name='v_n' value='".$vOut_n."' />" : "";
$downloadFormHTML .= "<input type='submit' class='btn blue' value='Click here' />";
$downloadLinkHTML = "<a target='_new' href='vault_file_download.php?";
$downloadLinkHTML .= "txid=".$txId;
$downloadLinkHTML .= ($vOut_n != -1) ? "&v_n=".$vOut_n : "";
$downloadLinkHTML .= "' class='btn blue'>Click here</a>";
echo "<tr><th style='border-style: ridge;'>"."Download Link"."</th><td style='border-style: ridge;'>".$downloadLinkHTML."</td></tr>";
echo "</table></div></p>";
}
else
{
throw new Exception("No Transaction ID found.");
}
}
catch(Exception $e)
{
echo "<h3 style='color:red'>".$e->getMessage()."</h3>";
}
?>