diff --git a/NewPastePanel.php b/NewPastePanel.php index 3be6728..376c9c6 100644 --- a/NewPastePanel.php +++ b/NewPastePanel.php @@ -13,6 +13,10 @@
+ +
+ +
@@ -27,7 +31,24 @@
- + +
+ + +
+
diff --git a/NewestPastes.php b/NewestPastes.php index dc85f53..8cfa522 100644 --- a/NewestPastes.php +++ b/NewestPastes.php @@ -4,7 +4,7 @@
query('SELECT * FROM pastes ORDER BY id DESC LIMIT 5'); + $stmt = $conn->query('SELECT * FROM pastes WHERE exposure=0 ORDER BY id DESC LIMIT 5'); while($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $title = $row['title']; if(strlen($title)>25)$title = substr($title,0,25)."..."; diff --git a/ViewPaste.php b/ViewPaste.php index 7bfafe3..6f91cb4 100644 --- a/ViewPaste.php +++ b/ViewPaste.php @@ -1,15 +1,24 @@ -
-
+
+
+
query('SELECT * FROM pastes WHERE uid="'.$uid.'"'); if($result = $stmt->fetch(PDO::FETCH_ASSOC)){ + $conn = null; + if($result["exposure"]==2 && $result["owner"]!=GetUsersIDBySession($_COOKIE["pp_sid"],$_COOKIE["pp_skey"])){ + echo "

This paste is private

"; + die(); + } echo "

".$result["title"]."

"; echo ""; } else echo "Paste does not exist"; + $conn = null; } else echo "Error: id not set"; ?> -
+
+
\ No newline at end of file diff --git a/css/bootstrap.css b/css/bootstrap.css index 42c79d6..58db6ac 100644 --- a/css/bootstrap.css +++ b/css/bootstrap.css @@ -6757,4 +6757,4 @@ button.close { display: none !important; } } -/*# sourceMappingURL=bootstrap.css.map */ +/*# sourceMappingURL=bootstrap.css.map */ \ No newline at end of file diff --git a/includes/user.php b/includes/user.php index 286fa4c..6fa155e 100644 --- a/includes/user.php +++ b/includes/user.php @@ -1,7 +1,6 @@ prepare("SELECT uid FROM sessions WHERE id=:sid AND skey=:skey"); $stmt->bindParam(':skey', $skey); $stmt->bindParam(':sid', $sid); @@ -27,7 +26,17 @@ function UnsetBrowserCookies(){ setcookie("pp_sid", '', time() - 3600); setcookie("pp_skey", '', time() - 3600); } -function GetUsernameByID(){ - //Placeholder +function GetUserByID($id){ + include "config/config.php"; + $stmt = $conn->prepare("SELECT * FROM users WHERE id=:id"); + $stmt->bindParam(':id', $id); + $stmt->execute(); + if($result = $stmt->fetch()){ + $conn = null; + return $result; + } else { + $conn = null; + return array(-1,-1,-1,-1); + } } ?> \ No newline at end of file diff --git a/index.php b/index.php index a34725e..d250a6b 100644 --- a/index.php +++ b/index.php @@ -11,7 +11,7 @@