Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* \\Author: Thibault Napoléon "Imothep"
* \\Company: ISEN Yncréa Ouest
* \\Email: [email protected]
* \\Created Date: 05-Apr-2023 - 12:25:38
* \\Last Modified: 13-Apr-2023 - 10:26:05
*/
define('CHARACTERS', array('*', '#', 'o', 'x'));
<?php
/**
* \\Author: Thibault Napoléon "Imothep"
* \\Company: ISEN Yncréa Ouest
* \\Email: [email protected]
* \\Created Date: 05-Apr-2023 - 12:25:38
* \\Last Modified: 13-Apr-2023 - 10:36:33
*/
//----------------------------------------------------------------------------
/*
Organisation
1-Positionnement
2-Dimensions
3-Texte
4-Bordures et fonds
5-Propriétés CSS3 ou spécifiques navigateurs
*/
h1 {
body {
min-height: 100vh;
font-family: Arial, Helvetica, sans-serif;
background: radial-gradient(rgb(233, 233, 233), rgb(187, 187, 187));
}
<h1>Todo List</h1>
<h2>Gestionnaire de tâches</h2>
<form>
<label for="item">Ajouter une tâche</label>
<div class="fields">
<input type="text" id="item" placeholder="Intitulé de la tâche" />
</div>
<button type="submit">Ajouter</button>
-- phpMyAdmin SQL Dump
-- version 5.1.0
-- https://www.phpmyadmin.net/
--
-- Host: localhost:8889
-- Generation Time: Jun 06, 2023 at 09:18 AM
-- Server version: 5.7.34
-- PHP Version: 8.0.8
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
@cladjidane
cladjidane / index.php
Created November 13, 2023 10:11
Todo List PHP - chapitre 4 - fin
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
session_start();
$notice = '';
$_SESSION['tasks'] = $_SESSION['tasks'] ?? [];
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $_POST['mode'] === 'add') {
$taskName = !empty($_POST['field-task']) ? $_POST['field-task'] : ($_POST['select-task'] ?? '');
@cladjidane
cladjidane / Index.php
Created November 14, 2023 10:45
Todolist - functions
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
session_start();
include('functions.php');
$notice = controllerTask();
$tasks = $_SESSION['tasks'];
<?php
function checkTaskDeadline($task) {
$currentDate = new DateTime();
$taskDate = DateTime::createFromFormat('Y-m-d', $task['date']);
$dateFormatted = $taskDate->format('d-m-Y');
if ($taskDate < $currentDate) {
$daysPassed = $currentDate->diff($taskDate)->format('%a');
$daysLimits = ['1' => 1, '2' => 3, '3' => 7];