-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
84 lines (77 loc) · 1.88 KB
/
index.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Is this a leap year?</title>
<style type="text/css">
body {
margin: 0;
padding: 0;
background: #0648a0;
}
#main-content {
margin: 30px;
text-align: center;
color: #FFF;
}
#main-content h1 {
font: 40px Arial, Helvetica, sans-serif;
}
#main-content p {
font: 24px "Times New Roman", Times, Georgia, serif;
}
input[type="text"] {
outline: none;
}
input[type="text"][value] {
color: #0B60D4;
}
input[type="submit"] {
color: #0648a0;
cursor: pointer;
}
input[type="submit"]:hover{
color: #043981;
}
input[type="submit"]:active{
color: #032B62;
}
</style>
</head>
<body>
<div id="main-content">
<h1>Is this a leap year?</h1>
<p>
<?php date_default_timezone_set("Europe/Sarajevo"); ?>
<?php
function is_leap_year($year) {
if($year % 4 > 0) {
return false; // 2023
} elseif($year % 100 > 0) {
return true; // 1988
} elseif($year % 400 > 0) {
return false; // 2200
} else {
return true; // 2400
}
}
if(isset($_GET["year"])) {
$year = intval($_GET["year"]);
} else {
$year = date('Y');
}
if(is_leap_year($year)) {
echo "Yes, {$year} is a leap year.";
} else {
echo "No, {$year} is not a leap year.";
}
?>
</p>
<form action="" method="get">
Enter a year to find out if it is a leap year:<br />
<input type="text" name="year" value="<?php echo $year; ?>" /><br>
<input type="submit" value="Submit" />
</form>
</div>
</body>
</html>