notif
This commit is contained in:
parent
f9154b632a
commit
e14497a06b
3 changed files with 35 additions and 1 deletions
|
@ -45,9 +45,31 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$poid = bin2hex(random_bytes(16));
|
||||||
|
|
||||||
$stmt = $db->prepare("INSERT INTO main.comment (username, targetType, targetId, date, content, id) VALUES (?,?,?,?,?,?)");
|
$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);
|
getOut($postType,$postId);
|
||||||
}
|
}
|
||||||
|
|
11
docs/notif.php
Normal file
11
docs/notif.php
Normal 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();
|
||||||
|
?>
|
|
@ -17,6 +17,7 @@
|
||||||
<?php
|
<?php
|
||||||
if (isset($username)) { ?>
|
if (isset($username)) { ?>
|
||||||
<a class="header-link" href="/user.php?id=<?php echo $username ?>"><?php echo $username ?></a>
|
<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>
|
<a class="header-link" href="/logout.php">Logout</a>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<a class="header-link" href="/login.php">Login</a>
|
<a class="header-link" href="/login.php">Login</a>
|
||||||
|
|
Loading…
Reference in a new issue