OLD | NEW |
1 <?php | 1 <?php |
2 header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); | 2 header("Expires: Thu, 01 Dec 2003 16:00:00 GMT"); |
3 header("Cache-Control: no-store, no-cache, must-revalidate"); | 3 header("Cache-Control: no-store, no-cache, must-revalidate"); |
4 header("Pragma: no-cache"); | 4 header("Pragma: no-cache"); |
5 header("Content-Type: text/plain"); | 5 header("Content-Type: text/plain"); |
6 header("Access-Control-Allow-Origin: http://127.0.0.1:8000"); | 6 header("Access-Control-Allow-Origin: http://127.0.0.1:8000"); |
| 7 $secure = isset($_GET["secure"]); |
7 $length = isset($_GET["length"]) ? (int) $_GET["length"] : 0; | 8 $length = isset($_GET["length"]) ? (int) $_GET["length"] : 0; |
8 if (!$length) { | 9 if (!$length) { |
9 setcookie("TestCookie", "TestCookieValue"); | 10 setcookie("TestCookie", "TestCookieValue", 0, "", "", $secure); |
10 } else { | 11 } else { |
11 $data = ""; | 12 $data = ""; |
12 for ($i = 0; $i < $length; $i++) { | 13 for ($i = 0; $i < $length; $i++) { |
13 $data .= "a"; | 14 $data .= "a"; |
14 } | 15 } |
| 16 if ($secure) |
| 17 $data .= "; Secure"; |
15 header("Set-Cookie: $data"); | 18 header("Set-Cookie: $data"); |
16 } | 19 } |
17 echo("Cookie set."); | 20 echo("Cookie set."); |
18 ?> | 21 ?> |
OLD | NEW |