Open Sencillo  2014.008
 All Data Structures Files Functions Variables Pages
cookies.php
Go to the documentation of this file.
1 <?php
2 /*~ cookies.php
3 .---------------------------------------------------------------------------.
4 | Software: Sencillo Cookies |
5 | Version: 2014.002 |
6 | Contact: ph@mastery.sk |
7 | ------------------------------------------------------------------------- |
8 | Author: Bc. Peter Horváth (original founder) |
9 | Copyright (c) 2014, Bc. Peter Horváth. All Rights Reserved. |
10 | ------------------------------------------------------------------------- |
11 | License: Distributed under the General Public License (GPL) |
12 | http://www.gnu.org/copyleft/gpl.html |
13 | This program is distributed in the hope that it will be useful - WITHOUT |
14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
15 | FITNESS FOR A PARTICULAR PURPOSE. |
16 '---------------------------------------------------------------------------'
17 ~*/
18 if((isset($cookie1))&&(isset($cookie2))&&(isset($LoginExp))&&($LoginExp>3600))
19 {
20  setcookie("ulid", $cookie1, $LoginExp);
21  setcookie("uid", $cookie2, $LoginExp);
22 }
24 //OAKEY subsystem
25 if($SiteOnlyAdmin==1)
26 {
27  if(($SiteOAkey==$_GET['oakey']) || ($_COOKIE['oakey']==$SiteOAkey))
28  {
29  if(($SiteOAKcookies==1) && ($_COOKIE['oakey']!=$SiteOAkey)){setcookie("oakey", $_GET['oakey'], $OAkeyexpire);}
30  $SiteStatusMessage="<span class='oakeyunlock'>Access granted by OAKEY=$SiteOAkey. Access only for you!</span><br>";
31  }
32  else
33  {
34  $SiteOffLine=1;
35  }
36 }
37 if($SiteOffLine==1)
38 {
39  die("<html>$SiteOffMessage $footbox</html>");
40 }
41 
52 {
53  private $name;
54  private $expiration;
55  private $data;
56 
60  public function __construct()
61  {
62  $this->expiration = time()+3600;
63  }
64 
69  public function setExpiration($time)
70  {
71  $this->expiration = time()+($time*60);
72  }
73 
79  public function addCookie($name,$data)
80  {
81  $this->name = $name;
82 
83  $this->data = $data;
84  setcookie($this->name,$this->data,$this->expiration);
85  }
86 
91  public function removeCookie($name)
92  {
93  $this->name = $name;
94 
95  setcookie($this->name,"",time()-3600);
96  }
97 
103  public function getCookie($name)
104  {
105  $this->name = $name;
106 
107  return $_COOKIE[$this->name];
108  }
109 }
110 ?>
$SiteOAKcookies
Definition: main-config.php:85
addCookie($name, $data)
Definition: cookies.php:79
$cookie1
Definition: session.php:146
setExpiration($time)
Definition: cookies.php:69
if((isset($cookie1))&&(isset($cookie2))&&(isset($LoginExp))&&($LoginExp >3600)) $SiteStatusMessage
Definition: cookies.php:23
$SiteOAkey
Definition: main-config.php:84
removeCookie($name)
Definition: cookies.php:91
getCookie($name)
Definition: cookies.php:103
$OAkeyexpire
Definition: main-config.php:88
$SiteOnlyAdmin
Definition: main-config.php:83
$LoginExp
Definition: session.php:149
$cookie2
Definition: session.php:147
__construct()
Definition: cookies.php:60
$SiteOffLine
Definition: main-config.php:81