Added admin privilages
This commit is contained in:
@@ -99,4 +99,21 @@ class Access extends \Core\Model
|
||||
echo $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
public function logout()
|
||||
{
|
||||
$id = \Core\Session::get('userid');
|
||||
if ($this->update(
|
||||
'user',
|
||||
['status' => 0],
|
||||
$id
|
||||
)) {
|
||||
\Core\Session::delete('userid');
|
||||
\Core\Session::delete('username');
|
||||
\Core\Session::delete('name');
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,15 +32,24 @@ class Post extends \Core\Model
|
||||
);
|
||||
}
|
||||
|
||||
public function showAll()
|
||||
public function showAll($conds = [])
|
||||
{
|
||||
try {
|
||||
$db = static::connectDB();
|
||||
|
||||
$sql = "SELECT * FROM pengumuman ORDER BY created_at";
|
||||
$sql = "SELECT * FROM pengumuman";
|
||||
|
||||
if ($conds) {
|
||||
$key = implode('', array_keys($conds));
|
||||
$sql .= " WHERE {$key} = ?";
|
||||
}
|
||||
|
||||
$query = $db->prepare($sql);
|
||||
|
||||
if ($conds) {
|
||||
$query->bindValue(1, implode('', array_values($conds)));
|
||||
}
|
||||
|
||||
if ($query->execute()) {
|
||||
if ($query->rowCount() != 0) {
|
||||
$result = $query->fetchAll(\PDO::FETCH_ASSOC);
|
||||
|
||||
Reference in New Issue
Block a user