enhancement addition

This commit is contained in:
Tutur33
2023-12-01 16:40:40 +01:00
parent 0416825f1d
commit b940162257
4 changed files with 92 additions and 14 deletions
+32 -4
View File
@@ -29,7 +29,7 @@ $monthName = $months[$month];
<link rel="icon" href="favicon.ico" type="image/x-icon"> <link rel="icon" href="favicon.ico" type="image/x-icon">
</head> </head>
<body> <body>
<main> <main class="main-calendar">
<h1>Calendar</h1> <h1>Calendar</h1>
<table> <table>
<tr> <tr>
@@ -126,8 +126,36 @@ $monthName = $months[$month];
} }
?> ?>
</tr> </tr>
</table> </table>
</main> </main>
<a href="index.php">back -></a> <main>
<a href="index.php" class="a-back">back -></a>
<form id="formMois" method="post">
<input type="hidden" id="year" name="year" value="<?php echo $year; ?>">
<input type="hidden" id="month" name="month" value="<?php echo $month; ?>">
<input type="submit" onclick="updateMonth(-1)" value="<-" class="btn">
<input type="submit" onclick="updateMonth(1)" value="->" class="btn">
</form>
</main>
<script>
function updateMonth(offset) {
var month = parseInt(document.getElementById("month").value) + offset;
var year = parseInt(document.getElementById("year").value);
if (month === 0) {
month = 12;
year -= 1;
}
if (month === 13) {
month = 1;
year += 1;
}
document.getElementById("month").value = month;
document.getElementById("year").value = year;
}
</script>
</body> </body>
</html> </html>
+8
View File
@@ -0,0 +1,8 @@
<?php
$callback = $_POST['callback'];
setcookie("$callback", '', time() - 3600, '/');
header("Location: index.php");
exit;
?>
+32 -9
View File
@@ -11,7 +11,7 @@
<header> <header>
<h1>Calendar</h1> <h1>Calendar</h1>
<form method="post" action="calendar.php"> <form method="post" action="calendar.php">
<label for="">Month :</label> <label for="month">Month :</label>
<select name="month"> <select name="month">
<?php <?php
$months = [ $months = [
@@ -36,7 +36,7 @@
?> ?>
</select> </select>
<label for="">Year :</label> <label for="year">Year :</label>
<select name="year"> <select name="year">
<?php <?php
for ($i = date("Y")-100; $i <= date("Y")+100; $i++) { for ($i = date("Y")-100; $i <= date("Y")+100; $i++) {
@@ -48,7 +48,7 @@
<button type="submit">Validate</button> <button type="submit">Validate</button>
</form> </form>
</header> </header>
<main> <main class="first-main">
<section> <section>
<h2>Welcome to the calendar generator</h2> <h2>Welcome to the calendar generator</h2>
<p>This site allows you to generate calendars for different months according to the year you specify. Enter the month and year in the form above and click on "Validate" to see the corresponding calendar.</p> <p>This site allows you to generate calendars for different months according to the year you specify. Enter the month and year in the form above and click on "Validate" to see the corresponding calendar.</p>
@@ -64,9 +64,9 @@
</section> </section>
</main> </main>
<main> <main>
<h2>Add a rappel :</h2> <h2>Add a callback :</h2>
<form method="post" action="create_rappel.php"> <form method="post" action="create_rappel.php">
<label for="">Day :</label> <label for="day">Day :</label>
<select name="day"> <select name="day">
<?php <?php
for ($j = 1; $j <= 31; $j++) { for ($j = 1; $j <= 31; $j++) {
@@ -76,7 +76,7 @@
?> ?>
</select> </select>
<label for="">Month :</label> <label for="month">Month :</label>
<select name="month"> <select name="month">
<?php <?php
foreach ($months as $value => $label) { foreach ($months as $value => $label) {
@@ -86,7 +86,7 @@
?> ?>
</select> </select>
<label for="">Year :</label> <label for="year">Year :</label>
<select name="year"> <select name="year">
<?php <?php
for ($i = date("Y")-100; $i <= date("Y")+100; $i++) { for ($i = date("Y")-100; $i <= date("Y")+100; $i++) {
@@ -96,9 +96,32 @@
?> ?>
</select> </select>
<label for="rappel">Rappel :</label> <label for="rappel">Callback :</label>
<input type="text" name="rappel" required> <input type="text" name="rappel" required>
<button type="submit">Validate</button> <button type="submit">add</button>
</form>
</main>
<main>
<h2>Delete a callback :</h2>
<form method="post" action="del_rappel.php">
<label for="callback">Callback :</label>
<select name="callback" class="sup-callback">
<?php
foreach ($_COOKIE as $nom_cookie => $valeur_cookie) {
$cut = explode("-", $nom_cookie);
if (count($cut) >= 3) {
$rappelday = $cut[0];
$rappelmonth = $cut[1];
$rappelyear = $cut[2];
} else {}
echo "<option value='$nom_cookie'>$rappelday/$rappelmonth/$rappelyear : $valeur_cookie</option>";
}
?>
</select>
<button type="submit">Delete</button>
</form> </form>
</main> </main>
</body> </body>
+20 -1
View File
@@ -37,6 +37,10 @@ header {
color: #fff; color: #fff;
text-align: center; text-align: center;
padding: 1em 0; padding: 1em 0;
position: fixed;
width: 100%;
top: 0;
left: 0;
} }
header h1 { header h1 {
@@ -52,6 +56,10 @@ form label {
margin-right: 10px; margin-right: 10px;
} }
.sup-callback {
width: 300px;
}
form input, form input,
form select { form select {
width: 100px; width: 100px;
@@ -59,12 +67,19 @@ form select {
margin-right: 10px; margin-right: 10px;
} }
form button { button,
a,
.btn {
padding: 7px 15px; padding: 7px 15px;
background-color: #292929; background-color: #292929;
color: #fff; color: #fff;
border: none; border: none;
cursor: pointer; cursor: pointer;
text-decoration: none;
}
.first-main {
margin-top: 150px;
} }
main { main {
@@ -86,3 +101,7 @@ main h2 {
main p { main p {
color: #555; color: #555;
} }
.main-calendar {
min-height: 500px;
}