2016-03-10 16:33:27 +01:00
|
|
|
<?php
|
|
|
|
session_start();
|
|
|
|
|
2016-03-11 11:35:34 +01:00
|
|
|
require '../lib/database.php';
|
|
|
|
require '../lib/project.php';
|
|
|
|
|
2016-03-10 16:33:27 +01:00
|
|
|
if(isset($_POST["disconect"])) {
|
|
|
|
$_SESSION = array();
|
|
|
|
session_destroy();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isset($_SESSION['user'], $_SESSION['password'])) {
|
|
|
|
|
|
|
|
$prout = $_SESSION['user'];
|
|
|
|
|
|
|
|
} else {
|
|
|
|
header('Location: index.php');
|
|
|
|
}
|
|
|
|
|
2016-03-11 11:35:34 +01:00
|
|
|
|
|
|
|
if (isset($_POST['project-name'], $_POST['description-project'])) {
|
|
|
|
$projectName = trim($_POST['project-name']);
|
|
|
|
$projectDescription = trim($_POST['description-project']);
|
|
|
|
|
|
|
|
$valid = true;
|
|
|
|
|
|
|
|
foreach ([$projectName, $projectDescription] as $field) {
|
|
|
|
if (empty($field)) {
|
|
|
|
$valid = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($valid) {
|
|
|
|
createProject($projectName, $projectDescription, new DateTime('now'));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2016-03-10 16:33:27 +01:00
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<meta charset="UTF-8">
|
|
|
|
<link rel="stylesheet" href="style.css" />
|
|
|
|
<title>
|
|
|
|
Mon super portfolio
|
|
|
|
</title>
|
|
|
|
</head>
|
|
|
|
<body style="font-family: Arial, sans-serif;">
|
|
|
|
<h1>Administration</h1>
|
|
|
|
<p>Bonjour <span style="font-weight: bold"><?php echo $prout ?></span></p>
|
|
|
|
|
|
|
|
<form action="" method="POST">
|
|
|
|
<input type="hidden" name="disconect" value="disconect"/>
|
|
|
|
<input type="submit" value="CIAO"/>
|
|
|
|
</form>
|
|
|
|
|
2016-03-11 11:35:34 +01:00
|
|
|
<h2>Gestion des projets</h2>
|
|
|
|
|
|
|
|
<p style="font-weight: bold;">Ajouter un projet sans mettre d'image parce que c'est trop long est chiant à faire</p>
|
|
|
|
|
|
|
|
<form action="" method="post">
|
|
|
|
<label for="project-name">Nom du projet</label>
|
|
|
|
<input style="display: block;" type="text" name="project-name" id="project-name"/>
|
|
|
|
<label for="description-project">Description du projet</label>
|
|
|
|
<textarea name="description-project" id="description-project" style="display: block;"></textarea>
|
|
|
|
|
|
|
|
<input type="submit" value="Ajouter"/>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<h3>Liste des projets</h3>
|
|
|
|
|
2016-03-10 16:33:27 +01:00
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
|