mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-12 14:40:09 +01:00
Fixed function getTotalPastes
getTotalPastes Fix for profile page.
This commit is contained in:
parent
8345d58d05
commit
3693d0be50
3 changed files with 19 additions and 5 deletions
|
@ -279,7 +279,9 @@ function jsonView($paste_id, $p_title, $p_conntent, $p_code) {
|
|||
|
||||
|
||||
function getTotalPastes(PDO $conn, string $username) : int {
|
||||
$query = $conn->prepare("SELECT COUNT(*) FROM pastes WHERE member = ?");
|
||||
$query = $conn->prepare("SELECT COUNT(*) AS total_pastes
|
||||
FROM pastes INNER JOIN users ON users.id = pastes.user_id
|
||||
WHERE users.username = ?");
|
||||
$query->execute([$username]);
|
||||
|
||||
return intval($query->fetch(PDO::FETCH_NUM)[0]);
|
||||
|
|
|
@ -64,7 +64,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
|||
|
||||
updatePageViews($conn);
|
||||
|
||||
$total_pastes = getTotalPastes($conn, $user_username);
|
||||
$total_user_pastes = getTotalPastes($conn, $user_username);
|
||||
|
||||
// Theme
|
||||
require_once('theme/' . $default_theme . '/header.php');
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
<div class="bd-main-container container">
|
||||
<div class="bd-duo">
|
||||
<div class="bd-lead">
|
||||
<h1 class="title is-5"><?php echo $lang['totalpastes'] . ' ' . $total_pastes ?></h1>
|
||||
<h1 class="title is-5"><?php echo $lang['totalpastes'] . ' ' . $total_user_pastes ?></h1>
|
||||
<h1 class="subtitle is-6"><?php echo '<a href="user.php?user=' . $_SESSION['username'] . '" target="_self">' . $lang['mypastes'] . '</a>'; ?></h1>
|
||||
<?php
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
@ -40,6 +40,20 @@
|
|||
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="field">
|
||||
<label class="label">Generate New Recovery Key</label>
|
||||
<div class="control has-icons-left has-icons-right">
|
||||
<input disabled="" type="text" class="input" name="username"
|
||||
style="cursor:not-allowed;" placeholder="New gen generated here">
|
||||
<span class="icon is-small is-left">
|
||||
<i class="fas fa-user"></i>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="field">
|
||||
<button type="submit" name="Gen_key" class="button is-info">Generate New Key</button>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="field">
|
||||
<label class="label">Username</label>
|
||||
<div class="control has-icons-left has-icons-right">
|
||||
|
@ -88,8 +102,6 @@
|
|||
</div>
|
||||
<div class="column">
|
||||
</div>
|
||||
<div class="column">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue