mirror of
				https://github.com/simon987/Much-Assembly-Required-Frontend.git
				synced 2025-10-30 02:36:53 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			46 lines
		
	
	
		
			735 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			46 lines
		
	
	
		
			735 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| 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;
 | |
|         }
 | |
|     }
 | |
| 
 | |
| 
 | |
| } |