This commit is contained in:
ui0ppk 2023-02-18 20:49:20 +02:00
parent e48ecd5117
commit 4bc68b299e
2 changed files with 68 additions and 47 deletions

View File

@ -160,7 +160,7 @@ class PartyStarter {
unset($_SESSION["user"]); unset($_SESSION["user"]);
} }
$query = $con->prepare('SELECT * FROM friends WHERE user=:id AND state="pending"'); $query = $con->prepare('SELECT * FROM friendships WHERE user1=:id AND isAccepted=1');
$query->bindParam(':id', $_SESSION['user'], PDO::PARAM_INT); $query->bindParam(':id', $_SESSION['user'], PDO::PARAM_INT);
$query->execute(); $query->execute();

View File

@ -2,18 +2,26 @@
-- version 5.2.0 -- version 5.2.0
-- https://www.phpmyadmin.net/ -- https://www.phpmyadmin.net/
-- --
-- Host: 127.0.0.1 -- Host: localhost
-- Generation Time: Feb 16, 2023 at 10:40 AM -- Generation Time: Feb 18, 2023 at 03:40 PM
-- Server version: 10.4.27-MariaDB -- Server version: 10.4.21-MariaDB-log
-- PHP Version: 8.2.0 -- PHP Version: 8.0.27
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION; START TRANSACTION;
SET time_zone = "+00:00"; SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
-- --
-- Database: `grublox` -- Database: `grublox`
-- --
CREATE DATABASE IF NOT EXISTS `grublox` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `grublox`;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -21,7 +29,8 @@ SET time_zone = "+00:00";
-- Table structure for table `catalog` -- Table structure for table `catalog`
-- --
CREATE TABLE IF NOT EXISTS `catalog` ( DROP TABLE IF EXISTS `catalog`;
CREATE TABLE `catalog` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`name` varchar(50) NOT NULL, `name` varchar(50) NOT NULL,
`description` varchar(255) NOT NULL, `description` varchar(255) NOT NULL,
@ -35,7 +44,7 @@ CREATE TABLE IF NOT EXISTS `catalog` (
`limited` int(1) DEFAULT 0, `limited` int(1) DEFAULT 0,
`stock` int(11) NOT NULL DEFAULT 0, `stock` int(11) NOT NULL DEFAULT 0,
`state` varchar(50) NOT NULL `state` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -43,25 +52,13 @@ CREATE TABLE IF NOT EXISTS `catalog` (
-- Table structure for table `comments` -- Table structure for table `comments`
-- --
CREATE TABLE IF NOT EXISTS `comments` ( DROP TABLE IF EXISTS `comments`;
CREATE TABLE `comments` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`user` int(11) NOT NULL, `user` int(11) NOT NULL,
`type` varchar(250) NOT NULL, `type` varchar(250) NOT NULL,
`text` varchar(500) NOT NULL `text` varchar(500) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `friends`
--
CREATE TABLE IF NOT EXISTS `friends` (
`id` int(11) NOT NULL,
`user` int(11) NOT NULL,
`state` varchar(50) NOT NULL DEFAULT 'pending',
`friend` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -69,12 +66,14 @@ CREATE TABLE IF NOT EXISTS `friends` (
-- Table structure for table `friendships` -- Table structure for table `friendships`
-- --
CREATE TABLE IF NOT EXISTS `friendships` ( DROP TABLE IF EXISTS `friendships`;
CREATE TABLE `friendships` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`user1` int(11) NOT NULL, `user1` int(11) NOT NULL,
`user2` int(11) NOT NULL, `user2` int(11) NOT NULL,
`isAccepted` int(11) NOT NULL DEFAULT 0 `isAccepted` int(11) NOT NULL DEFAULT 0,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; `date` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -82,7 +81,8 @@ CREATE TABLE IF NOT EXISTS `friendships` (
-- Table structure for table `games` -- Table structure for table `games`
-- --
CREATE TABLE IF NOT EXISTS `games` ( DROP TABLE IF EXISTS `games`;
CREATE TABLE `games` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`name` varchar(50) NOT NULL, `name` varchar(50) NOT NULL,
`description` varchar(255) NOT NULL, `description` varchar(255) NOT NULL,
@ -92,8 +92,8 @@ CREATE TABLE IF NOT EXISTS `games` (
`state` varchar(50) NOT NULL, `state` varchar(50) NOT NULL,
`date` datetime NOT NULL DEFAULT current_timestamp(), `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 `thumbnail` mediumtext NOT NULL DEFAULT '/assets/placeholder2.png'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -101,13 +101,28 @@ CREATE TABLE IF NOT EXISTS `games` (
-- Table structure for table `jobs` -- Table structure for table `jobs`
-- --
CREATE TABLE IF NOT EXISTS `jobs` ( DROP TABLE IF EXISTS `jobs`;
CREATE TABLE `jobs` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`jobid` varchar(50) NOT NULL, `jobid` varchar(50) NOT NULL,
`placeid` int(11) NOT NULL, `placeid` int(11) NOT NULL,
`port` int(11) NOT NULL, `port` int(11) NOT NULL,
`name` varchar(50) NOT NULL `name` varchar(50) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Table structure for table `owned`
--
DROP TABLE IF EXISTS `owned`;
CREATE TABLE `owned` (
`id` int(11) NOT NULL,
`user` int(11) NOT NULL,
`item` int(11) NOT NULL,
`date` datetime NOT NULL DEFAULT current_timestamp()
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -115,14 +130,15 @@ CREATE TABLE IF NOT EXISTS `jobs` (
-- Table structure for table `tokens` -- Table structure for table `tokens`
-- --
CREATE TABLE IF NOT EXISTS `tokens` ( DROP TABLE IF EXISTS `tokens`;
CREATE TABLE `tokens` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`token` varchar(500) NOT NULL, `token` varchar(500) NOT NULL,
`placeid` int(11) NOT NULL, `placeid` int(11) NOT NULL,
`userid` int(11) NOT NULL, `userid` int(11) NOT NULL,
`passedplacelauncher` int(11) NOT NULL DEFAULT 0, `passedplacelauncher` int(11) NOT NULL DEFAULT 0,
`passedjoinscript` int(11) NOT NULL DEFAULT 0 `passedjoinscript` int(11) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- -------------------------------------------------------- -- --------------------------------------------------------
@ -130,7 +146,8 @@ CREATE TABLE IF NOT EXISTS `tokens` (
-- Table structure for table `users` -- Table structure for table `users`
-- --
CREATE TABLE IF NOT EXISTS `users` ( DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`username` varchar(20) NOT NULL, `username` varchar(20) NOT NULL,
`password` varchar(450) NOT NULL, `password` varchar(450) NOT NULL,
@ -140,7 +157,7 @@ CREATE TABLE IF NOT EXISTS `users` (
`money` int(11) NOT NULL DEFAULT 10, `money` int(11) NOT NULL DEFAULT 10,
`lastPaid` varchar(30) DEFAULT current_timestamp(), `lastPaid` varchar(30) DEFAULT current_timestamp(),
`admin` int(1) NOT NULL DEFAULT 0 `admin` int(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --
-- Indexes for dumped tables -- Indexes for dumped tables
@ -158,12 +175,6 @@ ALTER TABLE `catalog`
ALTER TABLE `comments` ALTER TABLE `comments`
ADD PRIMARY KEY (`id`); ADD PRIMARY KEY (`id`);
--
-- Indexes for table `friends`
--
ALTER TABLE `friends`
ADD PRIMARY KEY (`id`);
-- --
-- Indexes for table `friendships` -- Indexes for table `friendships`
-- --
@ -182,6 +193,12 @@ ALTER TABLE `games`
ALTER TABLE `jobs` ALTER TABLE `jobs`
ADD PRIMARY KEY (`id`); ADD PRIMARY KEY (`id`);
--
-- Indexes for table `owned`
--
ALTER TABLE `owned`
ADD PRIMARY KEY (`id`);
-- --
-- Indexes for table `tokens` -- Indexes for table `tokens`
-- --
@ -210,12 +227,6 @@ ALTER TABLE `catalog`
ALTER TABLE `comments` ALTER TABLE `comments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `friends`
--
ALTER TABLE `friends`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
-- --
-- AUTO_INCREMENT for table `friendships` -- AUTO_INCREMENT for table `friendships`
-- --
@ -234,6 +245,12 @@ ALTER TABLE `games`
ALTER TABLE `jobs` ALTER TABLE `jobs`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `owned`
--
ALTER TABLE `owned`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
-- --
-- AUTO_INCREMENT for table `tokens` -- AUTO_INCREMENT for table `tokens`
-- --
@ -244,5 +261,9 @@ ALTER TABLE `tokens`
-- AUTO_INCREMENT for table `users` -- AUTO_INCREMENT for table `users`
-- --
ALTER TABLE `users` ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT; COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;