Commit a20aa963 authored by Michael Ochmann's avatar Michael Ochmann

added "OK" alert

parent 5ee13202
...@@ -6,5 +6,6 @@ class AlertLevel { ...@@ -6,5 +6,6 @@ class AlertLevel {
const ERROR = "alert-danger"; const ERROR = "alert-danger";
const WARNING = "alert-warning"; const WARNING = "alert-warning";
const INFO = "alert-info"; const INFO = "alert-info";
const OK = "alert-success";
const NORMAL = "alert-default"; const NORMAL = "alert-default";
} }
\ No newline at end of file
...@@ -30,8 +30,11 @@ class PostHandler { ...@@ -30,8 +30,11 @@ class PostHandler {
$query->bind_param("s", $shortcode); $query->bind_param("s", $shortcode);
$query->execute(); $query->execute();
$query->store_result(); $query->store_result();
if ($query->num_rows > 0) if ($query->num_rows > 0) {
new Alert("Der Shortcode <code>$shortcode</code> ist leider bereits vergeben.", AlertLevel::WARNING); new Alert("Der Shortcode <code>$shortcode</code> ist leider bereits vergeben.", AlertLevel::WARNING);
header("Location: ./");
exit;
}
$query = $this->db->prepare("INSERT INTO urls (url, shortcode, rft) VALUES(?, ?, ?)"); $query = $this->db->prepare("INSERT INTO urls (url, shortcode, rft) VALUES(?, ?, ?)");
$query->bind_param( $query->bind_param(
...@@ -41,6 +44,7 @@ class PostHandler { ...@@ -41,6 +44,7 @@ class PostHandler {
$this->root->authenticator->user() $this->root->authenticator->user()
); );
$query->execute(); $query->execute();
new Alert("Dein Link wurde hinzugefügt.", AlertLevel::OK);
header("Location: ./"); header("Location: ./");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment