summaryrefslogtreecommitdiff
path: root/model/User.php
diff options
context:
space:
mode:
authorcflip <36554078+cflip@users.noreply.github.com>2021-05-08 17:30:08 -0600
committerGitHub <noreply@github.com>2021-05-08 17:30:08 -0600
commit87b1dfd1f77b08915ee5e905da45e316ba2c0e7d (patch)
treef6c0f8d09454b6e887df0f66ca37c1ce9efb30d0 /model/User.php
parent0b045d57b2164b5ce003955d79627ae506a153eb (diff)
parenta09d9f377f5c055e42e5f21b5cdea64c2e2ca896 (diff)
Merge pull request #14 from cflip/refactor
Huge refactor
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