36 lines
1.7 KiB
PHP
36 lines
1.7 KiB
PHP
<?php include('header.php'); ?>
|
|
<div id="centre">
|
|
<?php
|
|
$fichier = fopen('config.txt','r');
|
|
fgets($fichier);
|
|
$week = fgets($fichier);
|
|
|
|
$sql = $bdd->prepare('SELECT done, group_id FROM users WHERE id = :id');
|
|
$sql->execute(array('id' => $_SESSION['ID']));
|
|
$result = $sql->fetch();
|
|
|
|
if (!$result['group_id']) {
|
|
echo '<span style="color:red">Tu est Admin, pas Membre !<br/>Tu n\'as donc pas à remplir de rapport =)</span><br/><a href="report.php">Retour à l\'acceuil</a>';
|
|
} else if ($result['done']) {
|
|
echo '<span style="color:green">Tu as déjà rempli ton rapport ! Merci =)</span><br/><a href="report.php"/>Retour à l\'acceuil</a>';
|
|
} else if (isset($_POST['fait'], $_POST['afaire']) && $_POST['fait'] != NULL && $_POST['afaire'] != NULL) {
|
|
$sql = $bdd->prepare('INSERT INTO reports (group_id, user_id, fait, afaire, date, week) VALUES (:group_id, :user_id, :fait, :afaire, :date, :week)');
|
|
$sql->execute(array('group_id' => $result['group_id'], 'user_id' => $_SESSION['ID'], 'fait' => $_POST['fait'], 'afaire' => $_POST['afaire'], 'date' => date('Y-m-d'), 'week' => $week));
|
|
|
|
if ($_SESSION['ID'] != 77316 && $_SESSION['ID'] != 76166) {
|
|
$sql = $bdd->prepare('UPDATE users SET done = 1 WHERE id = :id');
|
|
$sql->execute(array('id' => $_SESSION['ID']));
|
|
}
|
|
|
|
echo '<span style="color:green">Merci =) Bonne journée ^^</span><br/><a href="report.php">Retour à l\'acceuil</a>';
|
|
} else {
|
|
?>
|
|
|
|
<form method="post" action="envoyer.php">
|
|
Ce que tu as fait : <input name="fait" type="text" size="50" /><br />
|
|
Ce que tu va faire : <input name="afaire" type="text" size="50" /><br /><br />
|
|
<input name="Reset" type="reset" value="Reset" /> <input name="Submit" type="submit" value="OK" />
|
|
</form>
|
|
|
|
<?php } include('footer.php'); ?>
|