Browse Source

Add message notification thingie

master
Dendy 1 year ago
parent
commit
88f618b007
Signed by: dendy GPG Key ID: 0168B35FFD7F608F
  1. 4
      config.php
  2. 17
      include/header.php

4
config.php

@ -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();
}
?>

17
include/header.php

@ -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>

Loading…
Cancel
Save