Made things functional, decrypt still doesn't work
This commit is contained in:
18
submit.php
18
submit.php
@@ -1,15 +1,9 @@
|
||||
<?php
|
||||
require $root."enc.php";
|
||||
$enc = encrypt($_POST["words"], $current_key);
|
||||
$postID = bin2hex(openssl_random_pseudo_bytes(7));
|
||||
require "enc.php";
|
||||
$enc = encrypt($_POST["words"], $_POST["key"]);
|
||||
$content = '<iv>'.$enc[1].'</iv>'.'<tag>'.$enc[2].'</tag>'.'<content>'.$enc[0]."</content>";
|
||||
|
||||
$stmt = $conn->prepare("INSERT INTO posts (id, user_id, text, iv, tag) VALUES (:id, :uid, :txt, :iv, :tag)");
|
||||
$stmt->bindParam(":id", $postID);
|
||||
$stmt->bindParam(":uid", $current_userID);
|
||||
$stmt->bindParam(":txt", $enc[0]);
|
||||
$stmt->bindParam(":iv", $enc[1]);
|
||||
$stmt->bindParam(":tag", $enc[2]);
|
||||
$stmt->execute();
|
||||
|
||||
header("Location: /500/read/?post=".$postID);
|
||||
header('Content-type: text/plain');
|
||||
header('Content-Disposition: attachment; filename="encrypted.txt"');
|
||||
echo $content;
|
||||
?>
|
||||
Reference in New Issue
Block a user