Time to generate Page

This commit is contained in:
Michał Gdula 2022-10-12 15:43:32 +00:00
parent 646b41e90a
commit e7a2284809
9 changed files with 61 additions and 19 deletions

View file

@ -157,6 +157,7 @@
<?php
if ($user_info->is_admin($conn, $_SESSION['id'])) {
$sql_start = microtime(true);
?>
<div class="defaultDecoration defaultSpacing defaultFonts">
<h2>Admin</h2>
@ -396,8 +397,10 @@
<?php
foreach ($check_sanity as $result) {
if (str_contains($result, "Critical")) {
$result = str_replace("Critical:", "<img class='svg' src='assets/icons/warning.svg'>", $result);
echo "<p class='btn btn-bad' style='outline: none; cursor: default;'>".$result."</p>";
} elseif (str_contains($result, "Warning")) {
$result = str_replace("Warning:", "<img class='svg' src='assets/icons/warning.svg'>", $result);
echo "<p class='btn btn-warning' style='outline: none; cursor: default;'>".$result."</p>";
}
}
@ -405,6 +408,7 @@
?>
</div>
<?php
$sql_end = microtime(true);
}
} else {
?>
@ -482,7 +486,9 @@
}
?>
<?php include __DIR__."/assets/ui/footer.php"; ?>
<?php
include __DIR__."/assets/ui/footer.php";
?>
</body>
</html>

View file

@ -1,4 +1,6 @@
<?php
$exec_start = microtime(true);
require_once dirname(__DIR__)."/app/server/conn.php";
require_once dirname(__DIR__)."/app/app.php";
require_once dirname(__DIR__)."/app/settings/settings.php";

View file

@ -24,7 +24,7 @@
"Eat hotchip and lie"
],
"license":"GPL 3.0",
"version": "22.10.5",
"version": "22.10.12",
"user_name": "[your name]",
"is_testing": true,
"upload": {

View file

@ -1,7 +1,37 @@
<?php
if (isset($sql_start) && isset($sql_end)) {
$sql_time = $sql_end - $sql_start;
$sql_time = round($sql_time, 6) * 1000;
if ($sql_time > 0) {
$sql_time = "(SQL ".$sql_time."ms)";
} else {
$sql_time = "(SQL <0ms)";
}
} else {
$sql_time = "";
}
if (isset($exec_start)) {
$exec_end = microtime(true);
$exec_time = ($exec_end - $exec_start);
$exec_time = round($exec_time, 6) * 1000;
} else {
$exec_time = 0;
}
?>
<footer>
<p>Hosted by <?php echo $user_settings['user_name']; ?></p>
<hr>
<a class='link' href="https://github.com/Fluffy-Bean/image-gallery">Made by Fluffy</a>
<hr>
<p>Version <?php echo $user_settings['version']; ?></p>
<p>Copyright <?php echo $user_settings['user_name']; ?></p>
<hr>
<a class='link' href="https://github.com/Fluffy-Bean/image-gallery">Made by Fluffy</a>
<hr>
<p>V<?php echo $user_settings['version']; ?></p>
<?php
if ($exec_time != 0) {
echo "<hr>
<p>Generated in ".$exec_time."ms ".$sql_time."</p>";
}
?>
</footer>

View file

@ -270,7 +270,7 @@ nav .btn {
z-index: 9;
}
.gallery-item:active {
transform: scale(0.8) !important;
transform: scale(0.9) !important;
}
.gallery-item:after {
content: "";
@ -1015,7 +1015,7 @@ html {
body {
margin: 0 auto;
padding: 1rem;
max-width: 1000px;
max-width: 1200px;
min-height: calc(100vh - 2rem);
display: flex;
flex-direction: column;
@ -1084,25 +1084,21 @@ a.btn {
.btn-bad {
background-color: #B66467;
background-image: linear-gradient(to top, #ae5356, #B66467);
/*color: darken($warning, 40%);*/
}
.btn-warning {
background-color: #D8A657;
background-image: linear-gradient(to top, #d39b42, #D8A657);
/*color: darken($warning, 40%);*/
}
.btn-good {
background-color: #8C977D;
background-image: linear-gradient(to top, #7f8b6f, #8C977D);
/*color: darken($warning, 40%);*/
}
.btn-neutral {
background-color: #121212;
background-image: linear-gradient(to top, #111111, #121212);
/*color: $white;*/
}
/*

View file

@ -45,7 +45,7 @@ body {
margin: 0 auto;
padding: 1rem;
max-width: 1000px;
max-width: 1200px;
min-height: calc(100vh - 2rem);
@ -129,22 +129,21 @@ a.btn {
.btn-bad {
background-color: $warning;
background-image: linear-gradient(to top, darken($warning, 5%), $warning);
/*color: darken($warning, 40%);*/
}
.btn-warning {
background-color: $alert;
background-image: linear-gradient(to top, darken($alert, 5%), $alert);
/*color: darken($warning, 40%);*/
}
.btn-good {
background-color: $page-accent;
background-image: linear-gradient(to top, darken($page-accent, 5%), $page-accent);
/*color: darken($warning, 40%);*/
}
.btn-neutral {
background-color: $neutral;
background-image: linear-gradient(to top, darken($neutral, 0.5%), $neutral);
/*color: $white;*/
}
/*

View file

@ -94,7 +94,7 @@
}
&:active {
transform: scale(0.8) !important;
transform: scale(0.9) !important;
}
&:after {

View file

@ -67,7 +67,9 @@
<?php
// Reading images from table
$sql_start = microtime(true);
$image_request = mysqli_query($conn, "SELECT * FROM images ORDER BY id DESC");
$sql_end = microtime(true);
if (mysqli_num_rows($image_request) != 0) {
?>

View file

@ -68,7 +68,9 @@
<?php
// Reading images from table
$sql_start = microtime(true);
$sql = "SELECT * FROM images WHERE author = ? ORDER BY id DESC";
$sql_end = microtime(true);
if ($stmt = mysqli_prepare($conn, $sql)) {
// Bind variables to the prepared statement as parameters
@ -104,6 +106,11 @@
}
echo "</div>";
} else {
echo "<div class='info-text defaultFonts' style='text-align: center !important;'>
<h1>Nothing here!</h1>
<p>Come back later when the user uploads something!</p>
</div>";
}
}
?>