From c0cfbd7df8eb7471b719ab9c009643884fa0ba99 Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Sat, 1 Oct 2022 08:46:01 -0700 Subject: [PATCH] user permission --- class/Users.php | 4 ++-- items/read.php | 3 ++- users.sql | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/class/Users.php b/class/Users.php index 29d427f..0a7ede0 100644 --- a/class/Users.php +++ b/class/Users.php @@ -40,8 +40,8 @@ class Users{ function create(){ $stmt = $this->conn->prepare(" - INSERT INTO ".$this->itemsTable."(`id`, `firstname`, `lastname`, `email`, `password`, `country`, `birthdate`) - VALUES(?,?,?,?,?,?,?)"); + INSERT INTO ".$this->itemsTable."(`id`, `firstname`, `lastname`, `email`, `password`, `country`, `birthdate`, `permission`) + VALUES(?,?,?,?,?,?,?,'user')"); $this->id = htmlspecialchars(strip_tags($this->id)); $this->firstname = htmlspecialchars(strip_tags($this->firstname)); diff --git a/items/read.php b/items/read.php index 503942b..81a5349 100644 --- a/items/read.php +++ b/items/read.php @@ -29,7 +29,8 @@ if($result->num_rows > 0){ "email" => $email, "password" => $password, "country" => $country, - "birthdate" => $birthdate + "birthdate" => $birthdate, + "permission" => $permission ); array_push($itemRecords["items"], $itemDetails); } diff --git a/users.sql b/users.sql index 35dc3cb..7aae9cd 100644 --- a/users.sql +++ b/users.sql @@ -1 +1 @@ -CREATE TABLE `users` ( `id` varchar(15) NOT NULL, `firstname` varchar(30) NOT NULL, `lastname` varchar(30) NOT NULL, `email` varchar(30) NOT NULL, `password` varchar(30) NOT NULL, `country` varchar(30) NOT NULL, `birthdate` date NOT NULL, UNIQUE KEY `id` (`id`) ); \ No newline at end of file +CREATE TABLE `users` ( `id` varchar(15) NOT NULL, `firstname` varchar(30) NOT NULL, `lastname` varchar(30) NOT NULL, `email` varchar(30) NOT NULL, `password` varchar(30) NOT NULL, `country` varchar(30) NOT NULL, `birthdate` date NOT NULL, `permission` varchar(5) NOT NULL, UNIQUE KEY `id` (`id`) ); \ No newline at end of file