-
Notifications
You must be signed in to change notification settings - Fork 0
/
get4.php
40 lines (34 loc) · 1.41 KB
/
get4.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
// get4:
// - check presence and value of get2cookie and get3cookie
// - outputs "this is get4"
// compute the cookie for the current minute and display an authent error if the cookie presented by the client is older
$get2ExpectedCookie = "get2cookie" . date('Y-m-d_H-i');
$get3ExpectedCookie = "get3cookie" . date('Y-m-d_H-i');
if (!isset($_COOKIE['get2cookie'])) {
error_log("get4.php: get2cookie not set");
}
else{
$get2FoundCookie = $_COOKIE['get2cookie'];
error_log("get4.php: get2cookie=$get2FoundCookie");
if (!isset($_COOKIE['get3cookie'])) {
error_log("get4.php: get3cookie not set");
}
else {
$get3FoundCookie = $_COOKIE['get3cookie'];
error_log("get4.php: get3FoundCookie=$get3FoundCookie");
if ($get2ExpectedCookie !== $get2FoundCookie || $get3ExpectedCookie !== $get3FoundCookie){
echo "Authentification error<br>";
echo "Expected: <br>";
echo " $get2ExpectedCookie $get3ExpectedCookie<br>";
echo "Found: <br>";
echo " $get2FoundCookie $get3FoundCookie<br>";
}
}
}
?>
<p>this is get4</p>
<form action="/test/post.php" method="post">
<input type="hidden" name="scope" value="all">
<button class="button redB" style="margin: 5px;">Login</button>
</form>