lil bug fixes (fuck git)

This commit is contained in:
ui0ppk 2023-02-05 11:17:17 +02:00
commit 698473b1e9
6 changed files with 74 additions and 13 deletions

BIN
assets/placeholder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -75,20 +75,49 @@ $getitstarted->header();
</li>
</ul>
<div class="row row-cols-xl-6 row-cols-lg-4 row-cols-md-3 row-cols-sm-2 g-4" style="margin-left: 200px; margin-top: 1px;">
<?php $x = 40; for ($i = 1; $i <= $x; $i++) { ?>
<?php
$sql = "SELECT allStar FROM catalog";
$q = $con->prepare(str_replace('allStar', 'count(*)', $sql));
$q->execute();
$numberOfItems = $q->fetchColumn();
$q = $con->prepare(str_replace('allStar', '*', $sql));
$q->execute();
if ($numberOfItems >= 1) {
while ($item = $q->fetch()) {
$qq = $con->prepare("SELECT * FROM users WHERE id = :id");
$qq->bindParam(':id', $item["creator"], PDO::PARAM_INT);
$qq->execute();
$creator = $qq->fetch();
if(!$creator) {
$creator = [
"id" => 0,
"username" => "[ unknown user ]"
];
}
$x = 40;
for ($i = 1; $i <= $x; $i++) {
?>
<div class="position-relative col">
<div class="card shadow-sm h-100">
<img src="https://tr.rbxcdn.com/7ea42f95bb986a33dbd2dc391a3ee744/420/420/Gear/Png" class="card-img-top">
<a href="item.php?id=<?php echo (int)htmlspecialchars($item["id"]); ?>"><img src="<?php if (!empty($item["thumbnail"])) {echo htmlspecialchars($item["thumbnail"]);} else {echo "assets/placeholder.png";} ?>" class="card-img-top"></a>
<p class="me-1 mt-1 position-absolute top-0 end-0"><?php if(rand(1, $x) == $x) { echo '<span class="badge bg-success">Limited</span>'; }; ?></p>
<span class="fs-6 mt-2 ms-2 opacity-75 position-absolute top-50 start-0 translate-middle-y bg-success badge">$1</span></img>
<span class="fs-6 mt-2 ms-2 opacity-75 position-absolute top-50 start-0 translate-middle-y bg-success badge">$<?php echo (int)htmlspecialchars($item["price"]); ?></span></img>
<div class="card-body">
<h5 class="card-title">Minion</h5>
<h5 class="card-title"><?php echo htmlspecialchars($item["name"]); ?></h5>
<p class="card-text">
By <a class="btn-link">someone</a>
By <a href="user.php?id=<?php echo (int)htmlspecialchars($creator["id"]); ?>" class="btn-link"><?php echo htmlspecialchars($creator["username"]); ?></a>
</p>
</div>
</div>
</div> <?php if ($i == $x) { break; } }?> </div>
</div>
<?php
if ($i == $x) {
break;
}
}
}
} else {
echo "no items";} ?> </div>
<br>
</div>
</main>

View File

@ -17,7 +17,7 @@ class User {
public function getMoney($short) {
if ($short == "true") {
$money = $this->$query->sqlData["money"];
$money = $this->sqlData["money"];
if ($money < 1000000) {
// Anything less than a million
@ -31,7 +31,7 @@ class User {
}
} else {
return $this->$query->sqlData["money"];
return $this->sqlData["money"];
}
}

View File

@ -41,7 +41,7 @@ $getitstarted->header();
for ($i = 1; $i <= $x; $i++) { ?>
<div class="card bg-dark border-start rounded shadow-sm" style="max-width: 170px; margin-right: 9px;">
<a href="game?id=<?php echo (int)htmlspecialchars($game["id"]); ?>" style="text-decoration: none; text-align: left; margin-bottom: 9px;">
<img src="<?php if (!empty($game["thumbnail"])) {echo htmlspecialchars($game["thumbnail"]);} else {echo "https://media.discordapp.net/attachments/1051588176805892156/1071555366887891064/placeholder.png";} ?>" class="card-img-top rounded-top<?php if(empty($game["thumbnail"])){echo " placeholder";} ?>" alt="<?php echo htmlspecialchars($game["name"]); ?>">
<img src="<?php if (!empty($game["thumbnail"])) {echo htmlspecialchars($game["thumbnail"]);} else {echo "assets/placeholder.png";} ?>" class="card-img-top rounded-top" alt="<?php echo htmlspecialchars($game["name"]); ?>">
<div class="card-body">
<small class="card-title text-white" style="font-size: 1rem;"><?php echo htmlspecialchars($game["name"]); ?></small>
<br>

View File

@ -1,10 +1,11 @@
-- nolanwhy
-- phpMyAdmin SQL Dump
-- version 5.2.0
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Feb 04, 2023 at 10:58 PM
-- Generation Time: Feb 05, 2023 at 10:10 AM
-- Server version: 10.4.27-MariaDB
-- PHP Version: 8.0.25
@ -18,6 +19,23 @@ SET time_zone = "+00:00";
-- --------------------------------------------------------
--
-- Table structure for table `catalog`
--
CREATE TABLE `catalog` (
`id` int(11) NOT NULL,
`name` varchar(50) NOT NULL,
`description` varchar(255) NOT NULL,
`creator` int(11) NOT NULL,
`price` int(11) NOT NULL,
`thumbnail` mediumtext NOT NULL,
`date` datetime NOT NULL DEFAULT current_timestamp(),
`lastupdated` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
--
-- Table structure for table `games`
--
@ -28,7 +46,8 @@ CREATE TABLE `games` (
`description` varchar(255) NOT NULL,
`creator` int(11) NOT NULL,
`date` datetime NOT NULL DEFAULT current_timestamp(),
`updateddate` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp()
`updateddate` datetime NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
`thumbnail` mediumtext NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
-- --------------------------------------------------------
@ -51,6 +70,12 @@ CREATE TABLE `users` (
-- Indexes for dumped tables
--
--
-- Indexes for table `catalog`
--
ALTER TABLE `catalog`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `games`
--
@ -67,6 +92,12 @@ ALTER TABLE `users`
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `catalog`
--
ALTER TABLE `catalog`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;
--
-- AUTO_INCREMENT for table `games`
--
@ -78,4 +109,4 @@ ALTER TABLE `games`
--
ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
COMMIT;
COMMIT;

View File

@ -22,9 +22,10 @@ if(isset($_POST['submit'])) {
$query->execute();
$result = $query->fetchColumn();
if ($result > 0) {
if (password_verify($password, $user->getPassword($con, $username))) {
if (password_verify($password, $user->getPassword())) {
$_SESSION["user"] = $user->getID($con, $username);
header("Location: /home");
header('location: /home');
//echo $_SESSION["user"];
} else {
$passwordiswrong = true;