summaryrefslogtreecommitdiff
path: root/model/User.php
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-04-23 18:43:12 -0600
committercflip <36554078+cflip@users.noreply.github.com>2021-04-23 18:43:12 -0600
commit6c9369ad85f2fb3dc61234b54db7e7079cdc0c4e (patch)
tree0275f6627930f6edff72b0ebba7813b746d3c228 /model/User.php
parentf469e37a0a5d90350a6abd6a0c7b92b019f377e1 (diff)
Refactoring part 1
Diffstat (limited to 'model/User.php')
-rw-r--r--model/User.php57
1 files changed, 0 insertions, 57 deletions
diff --git a/model/User.php b/model/User.php
deleted file mode 100644
index 469a9a1..0000000
--- a/model/User.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-
-class User {
- public $id;
- public $name = 'Unknown';
- public $date = 0;
- public $level = 0;
-
- function get_by_name($name, $dbc) {
- $sql = "SELECT user_id, user_date, user_level FROM users WHERE user_name = ?";
- $stmt = mysqli_stmt_init($dbc);
-
- if (!mysqli_stmt_prepare($stmt, $sql)) {
- echo 'Failed to get user: ' . mysqli_error($dbc);
- }
-
- mysqli_stmt_bind_param($stmt, "s", $name);
- mysqli_stmt_execute($stmt);
-
- $result = mysqli_stmt_get_result($stmt);
-
- if (mysqli_num_rows($result) == 0) {
- } else {
- while ($row = mysqli_fetch_assoc($result)) {
- $this->id = $row['user_id'];
- $this->name = $name;
- $this->date = $row['user_date'];
- $this->level = $row['user_level'];
- }
- }
-
- mysqli_free_result($result);
- mysqli_stmt_close($stmt);
- }
-
- function get_by_id($id, $dbc) {
- $sql = "SELECT user_name, user_date, user_level FROM users WHERE user_id = " . mysqli_real_escape_string($dbc, $id);
- $result = mysqli_query($dbc, $sql);
-
- if (!$result) {
- echo 'Failed to get user: ' . mysqli_error($dbc);
- }
-
- if (mysqli_num_rows($result) == 0) {
- } else {
- while ($row = mysqli_fetch_assoc($result)) {
- $this->id = $id;
- $this->name = $row['user_name'];
- $this->date = $row['user_date'];
- $this->level = $row['user_level'];
- }
- }
-
- mysqli_free_result($result);
- }
-
-} \ No newline at end of file