Add user/delete method
This commit is contained in:
parent
d0802ea4c9
commit
f3109c51a0
@ -132,4 +132,18 @@ final class UserController
|
|||||||
|
|
||||||
header("Location: /user");
|
header("Location: /user");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteAction(Array $A_urlParams = null, Array $A_postParams = null)
|
||||||
|
{
|
||||||
|
Session::login_or_die();
|
||||||
|
|
||||||
|
$O_userModel = new UserModel();
|
||||||
|
|
||||||
|
$O_userModel->deleteByID($_SESSION["ID"]);
|
||||||
|
|
||||||
|
Session::destroy_session();
|
||||||
|
|
||||||
|
header("Location: /");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -85,4 +85,11 @@ final class UserModel
|
|||||||
$stmt->bindParam("new_username", $S_newUsername);
|
$stmt->bindParam("new_username", $S_newUsername);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function deleteByID($I_id){
|
||||||
|
$O_model = Model::get();
|
||||||
|
$stmt = $O_model->prepare("DELETE FROM USER WHERE ID=:id");
|
||||||
|
$stmt->bindParam("id", $I_id);
|
||||||
|
$stmt->execute();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user