diff options
Diffstat (limited to 'models')
| -rw-r--r-- | models/cookies.php | 7 | ||||
| -rw-r--r-- | models/database.php | 6 |
2 files changed, 13 insertions, 0 deletions
diff --git a/models/cookies.php b/models/cookies.php index a181022..ddc7d1c 100644 --- a/models/cookies.php +++ b/models/cookies.php @@ -24,6 +24,13 @@ class Cookie extends Table { )->UID; return User::fromDBuid($UID); } + + static function delete(string $token) { + Table::_delete( + 'Cookies', + "Token = \"$token\"" + ); + } } // Taken from https://stackoverflow.com/a/15875555 diff --git a/models/database.php b/models/database.php index f472dbb..dc177e8 100644 --- a/models/database.php +++ b/models/database.php @@ -33,6 +33,12 @@ abstract class Table { return $id; } + static protected function _delete(string $table, string $condition) { + $conn = Table::connect(); + $query = $conn->query("DELETE FROM $table WHERE $condition"); + $conn = null; + } + static protected function _get_entries_count(string $table) : int { $conn = Table::connect(); $query = $conn->query("SELECT count(*) FROM $table"); |
