This commit is contained in:
biglyderv 2024-12-18 23:13:54 -05:00
parent f9154b632a
commit e14497a06b
3 changed files with 35 additions and 1 deletions

View file

@ -45,9 +45,31 @@
}
}
$poid = bin2hex(random_bytes(16));
$stmt = $db->prepare("INSERT INTO main.comment (username, targetType, targetId, date, content, id) VALUES (?,?,?,?,?,?)");
$stmt->execute([$username,$postType,$postId,microtime(true) - $ref,$postie,bin2hex(random_bytes(16))]);
$stmt->execute([$username,$postType,$postId,microtime(true) - $ref,$postie,$poid]);
$postieP = "https://nbg.dervland.net/comment.php?id=" . $poid;
$user10 = '%system';
if ($postType == 'user') {
$postie = "A user commented on your wall: " . $postieP;
$stmt = $db->prepare("INSERT INTO main.comment (username, targetType, targetId, date, content, id) VALUES (?,?,?,?,?,?)");
$stmt->execute([$user10,'notification',$postId,microtime(true) - $ref,$postie,bin2hex(random_bytes(16))]);
} else if ($postType == 'comment') {
$stmt = $db->prepare("SELECT * FROM comment WHERE id = ? ORDER BY date DESC");
$stmt->execute([
$poid
]);
$posts1 = $stmt->fetchAll(PDO::FETCH_DEFAULT);
$posts2 = $posts1[0]['username'];
$postie = "A user replied to your post: " . $postieP;
$stmt = $db->prepare("INSERT INTO main.comment (username, targetType, targetId, date, content, id) VALUES (?,?,?,?,?,?)");
$stmt->execute([$user10,'notification',$posts2,microtime(true) - $ref,$postie,bin2hex(random_bytes(16))]);
}
getOut($postType,$postId);
}

11
docs/notif.php Normal file
View file

@ -0,0 +1,11 @@
<?php
require("../libs/page.php");
require("../libs/form.php");
require("../libs/comment.php");
$ref = 1732684297;
page_header();
comments("notification",$username);
page_footer();
?>

View file

@ -17,6 +17,7 @@
<?php
if (isset($username)) { ?>
<a class="header-link" href="/user.php?id=<?php echo $username ?>"><?php echo $username ?></a>
<a class="header-link" href="/notif.php">Pings</a>
<a class="header-link" href="/logout.php">Logout</a>
<?php } else { ?>
<a class="header-link" href="/login.php">Login</a>