1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- /**
- * Public Printer Control System
- *
- * Copyright © 2018 - 2019, Aaron Speer, aaron.speerfamily.ie ajamesspeer@gmail.com.
- * All Rights Reserved.
- */
- namespace App;
- class Model {
- public function sanitiseData($data)
- {
- global $conn;
- $data = mysqli_real_escape_string($conn, $data);
- $data = htmlspecialchars($data);
- return $data;
- }
- public function getMessages()
- {
- return json_decode($_COOKIE["messages"]);
- $_SESSION["messages"] = "";
- }
- public function setMessage($name, $content, $type)
- {
- global $_SESSION;
- $passed = [$name, $content, $type];
- $messages = json_decode($_SESSION["messages"]);
- $messages[] = $passed;
- $_SESSION["messages"] = json_encode($messages);
- setcookie("messages", json_encode($messages), time() + 1, "/");
- }
- }
|