Add message notification thingie

This commit is contained in:
Dendy 2020-12-24 10:04:19 +01:00
parent e6c41fa25a
commit 88f618b007
Signed by: dendy
GPG Key ID: 0168B35FFD7F608F
2 changed files with 21 additions and 0 deletions

View File

@ -26,4 +26,8 @@ if(!isset($_SESSION["login"])){
$_IS_LOGGED = $_SESSION["login"] === "true";
$_IS_ADMIN = $_SESSION["username"] === "admin";
if(!is_array($_SESSION["msg"])){
$_SESSION["msg"] = array();
}
?>

View File

@ -17,6 +17,14 @@
#header{
text-align: center;
}
.alert{
margin: 20px;
padding: 5px;
color: orange;
border: solid orange 1px;
margin: auto;
width: 60vw;
}
</style>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<div id="header">
@ -41,4 +49,13 @@
<input type="text" name="t" value="<?php if($_GET["t"]) echo $_GET["t"]; ?>">
<input type="submit">
</form>
<?php
if(isset($_SESSION["msg"]) and is_array($_SESSION["msg"])){
foreach($_SESSION["msg"] as $message){
echo("<div class='alert'>" . $message . "</div>");
$_SESSION["msg"] = array();
}
}
?>
</div>