2017-11-22 19:13:00 -05:00

52 lines
817 B
PHP

<?php
/**
* Created by PhpStorm.
* User: simon
* Date: 24/09/17
* Time: 1:59 PM
*/
class MessageCookie
{
private $msg;
private $type;
/**
* MessageCookie constructor.
* @param $msg
* @param $type
*/
public function __construct($msg, $type)
{
$this->msg = $msg;
$this->type = $type;
}
public function setCookie()
{
setCookie($this->type, $this->msg);
}
/**
* Get message
* @param $type string
* @return string Cookie message
*/
public static function getMsg($type)
{
if (isset($_COOKIE[$type])) {
$msg = $_COOKIE[$type];
//Clear cookie
setcookie($type, "", -1);
return $msg;
} else {
return FALSE;
}
}
}