Fixed file uploading, other more minor fixes
This commit is contained in:
@@ -7,9 +7,8 @@
|
|||||||
<link rel=stylesheet href=style.css type=text/css>
|
<link rel=stylesheet href=style.css type=text/css>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<form action=decryptFunc.php method=POST enctype=multipart/form-data>
|
<form method=POST action=decryptFunc.php enctype="multipart/form-data">
|
||||||
<!--<input type=file name=doc accept=.txt >-->
|
<input type=file name=encDoc>
|
||||||
<textarea placeholder="Paste your encrypted file's contents here" name=words></textarea>
|
|
||||||
<input type=text name=key placeholder='Decryption key'>
|
<input type=text name=key placeholder='Decryption key'>
|
||||||
<button type=submit name=submit value=submit id=submitWriting>SUBMIT</button>
|
<button type=submit name=submit value=submit id=submitWriting>SUBMIT</button>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
require "enc.php";
|
require "enc.php";
|
||||||
$words = "<encrypted>".$_POST["words"]."</encrypted>";
|
$words = file_get_contents($_FILES["encDoc"]["tmp_name"]);
|
||||||
$data = simplexml_load_string($words) or die("Couldn't make object");
|
$data = simplexml_load_string($words) or die("Couldn't make object");
|
||||||
|
|
||||||
//Get the key
|
//Get the key
|
||||||
|
|||||||
4
fileUpload.php
Normal file
4
fileUpload.php
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<form method=POST action=uploaded.php enctype="multipart/form-data">
|
||||||
|
<input type=file name=encDoc>
|
||||||
|
<button type=submit>SUBMIT</button>
|
||||||
|
</form>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<form action=submit.php method=POST>
|
<form action=submit.php method=POST>
|
||||||
<h2 id=counter></h2>
|
<h2 id=counter>0</h2>
|
||||||
<textarea onkeyup=wordCount(this) placeholder='Write your words here...' name=words></textarea>
|
<textarea onkeyup=wordCount(this) placeholder='Write your words here...' name=words></textarea>
|
||||||
<input type=text name=key placeholder='Decryption key'>
|
<input type=text name=key placeholder='Decryption key'>
|
||||||
<button type=submit name=submit value=submit id=submitWriting>SUBMIT</button>
|
<button type=submit name=submit value=submit id=submitWriting>SUBMIT</button>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
require "enc.php";
|
require "enc.php";
|
||||||
$enc = encrypt($_POST["words"], $_POST["key"]);
|
$enc = encrypt($_POST["words"], $_POST["key"]);
|
||||||
$content = '<iv>'.bin2hex($enc[1]).'</iv>'.'<tag>'.bin2hex($enc[2]).'</tag>'.'<content>'.$enc[0]."</content>";
|
$content = "<encrypted>\n"." <iv>".bin2hex($enc[1])."</iv>\n"." <tag>".bin2hex($enc[2])."</tag>\n"." <content>".$enc[0]."</content>\n"."</encrypted>";
|
||||||
|
|
||||||
header('Content-type: text/plain');
|
header('Content-type: text/plain');
|
||||||
header('Content-Disposition: attachment; filename="encrypted.txt"');
|
header('Content-Disposition: attachment; filename="encrypted.txt"');
|
||||||
|
|||||||
3
uploaded.php
Normal file
3
uploaded.php
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
echo file_get_contents($_FILES["encDoc"]["tmp_name"]);
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user