Pastes now get an unique text id and can only be accessed by it

This commit is contained in:
pikami
2016-06-11 16:32:49 +00:00
parent 5d1d051760
commit 01448c5d65
4 changed files with 40 additions and 14 deletions

View File

@@ -1,12 +1,14 @@
<div class="panel panel-default">
<div class="panel-body">
<?php
if(isset($id)){
if(isset($uid)){
include "config/config.php";
$stmt = $conn->query('SELECT * FROM pastes WHERE id='.$id);
$result = $stmt->fetch(PDO::FETCH_ASSOC);
echo "<h1>".$result["title"]."</h1>";
echo "<textarea class=\"form-control\" rows=\"5\" disabled=\"true\">".$result["text"]."</textarea>";
$stmt = $conn->query('SELECT * FROM pastes WHERE uid="'.$uid.'"');
if($result = $stmt->fetch(PDO::FETCH_ASSOC)){
echo "<h1>".$result["title"]."</h1>";
echo "<textarea class=\"form-control\" rows=\"5\" disabled=\"true\">".$result["text"]."</textarea>";
}
else echo "Paste does not exist";
} else echo "Error: id not set";
?>
</div>