initial commit

This commit is contained in:
Luke Ogburn
2019-03-30 23:03:43 -04:00
commit 3d9e0c7717
29 changed files with 740 additions and 0 deletions

28
res/read.php Normal file
View File

@@ -0,0 +1,28 @@
<?php
require "enc.php";
require "conn.php";
conn();
$pid = $_GET["post"];
$usr = 4;
$stmt = $conn->prepare("SELECT * FROM posts WHERE id = :pid AND user_id = :uid");
$stmt->bindParam(":pid", $pid);
$stmt->bindParam(":uid", $usr);
$stmt->execute();
$post = $stmt->fetch(PDO::FETCH_OBJ);
//make sure the post belongs to the current user
$stmt = $conn->prepare("SELECT * FROM dec_info WHERE posts_id = :pid");
$stmt->bindParam(":pid", $pid);
$stmt->execute();
$dec_info = $stmt->fetch(PDO::FETCH_OBJ);
$text = $post->text;
$key = $dec_info->enc_key;
$iv = $dec_info->iv;
$tag = $dec_info->tag;
echo decrypt($text, $key, $iv, $tag);
?>